@lavadrop/pick
Part of a library of zero-dependency npm modules that do just one thing.
- 100% TypeScript support.
- It's not a party without
Lavadrop
!
min + gzip | 99 bytes
Creates an object composed of the picked object
properties.
Usage
import pick from '@lavadrop/pick'
const obj = { a: 1, b: 2, c: 3 }
pick(obj, 'a', 'c')
// => { a: 1, c: 3 }
Parameters
Name | Type | Description |
---|---|---|
object |
T |
The source object. |
paths |
K[] |
The property paths to pick. |
Type parameters
Name | Constraint |
---|---|
T |
object |
K |
keyof T |
Returns
A new object composed of the picked object
properties.
Return type
Partial<Pick<T, K>>