1
0
Fork 0
peertube/shared/core-utils/utils/object.ts
2021-07-29 10:27:24 +02:00

15 lines
268 B
TypeScript

function pick <T extends object> (object: T, keys: (keyof T)[]) {
const result: Partial<T> = {}
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
result[key] = object[key]
}
}
return result
}
export {
pick
}