Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 301 Bytes
94753b6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/**
* Return copy of object, only keeping allowlisted properties.
*/
export function pick<T, K extends keyof T>(o: T, props: K[] | ReadonlyArray<K>): Pick<T, K> {
return Object.assign(
{},
...props.map((prop) => {
if (o[prop] !== undefined) {
return { [prop]: o[prop] };
}
})
);
}
|