1
0
Fork 0
peertube/shared/core-utils/utils/object.ts

16 lines
284 B
TypeScript
Raw Normal View History

2021-07-29 05:54:38 -04:00
function pick <O extends object, K extends keyof O> (object: O, keys: K[]): Pick<O, K> {
const result: any = {}
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
result[key] = object[key]
}
}
return result
}
export {
pick
}