Category
From object, pick a set of properties whose keys are in the keys array. This is an implementation of the Pick<T, K> type in TypeScript.
object
keys
Pick<T, K>
Time complexity: O(n)
Space complexity: O(n)
The object you are picking entries from
The keys to keep from the object
A new object containing the picked entries
Object
const object = { a: 1, b: 2, c: 3 };pick(object, ['a', 'b']); // { a: 1, b: 2 } Copy
const object = { a: 1, b: 2, c: 3 };pick(object, ['a', 'b']); // { a: 1, b: 2 }
From
object
, pick a set of properties whose keys are in thekeys
array. This is an implementation of thePick<T, K>
type in TypeScript.Time complexity: O(n)
Space complexity: O(n)