pick
Import from @varavel/vdl-plugin-sdk/utils/objects.
Creates a new object composed of the picked object properties.
This function takes an object and an array of keys, and returns a new object that includes only the properties corresponding to the specified keys.
Type Parameters
| Type Parameter | Description |
|---|---|
T extends Record\<string, any> |
The type of object. |
K extends string | number | symbol |
The type of keys in object. |
Parameters
| Parameter | Type | Description |
|---|---|---|
obj |
T |
The object to pick keys from. |
keys |
readonly K[] |
An array of keys to be picked from the object. |
Returns
Pick\<T, K>
A new object with the specified keys picked.