pick
objectCreates an object composed of the picked object properties.
Signature
pick<T, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>Parameters
| Name | Type | Description |
|---|---|---|
obj | T | The source object |
keys | K[] | The property keys to pick |
Returns
Pick<T, K> - Returns the new object
Examples
Basic Usage
import { pick } from 'dashlite'
const object = { a: 1, b: 2, c: 3 }
const result = pick(object, ['a', 'c'])
console.log(result)Output:
{ a: 1, c: 3 }Available since version 1.0.0