only

Commons
stable

Extract a strict subset of an object's keys into a new object. Unlike pick, every listed key is copied unconditionally — the result contains all listed keys, even when they are undefined on the source.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

obj
required
T
The source object to extract properties from.
include
required
Array<U>
Array of key names to copy into the output. Each key is iterated and set on the clone regardless of whether it exists on the source.

API

Return value

The value returned by this util.

A new object containing only the listed keys and their values from the source.

Usage

Examples

Ready-to-paste usage snippets.

Extract specific keys

typescript