]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/core-utils/utils/object.ts
Refactor search query options
[github/Chocobozzz/PeerTube.git] / shared / core-utils / utils / object.ts
1 function pick <O extends object, K extends keyof O> (object: O, keys: K[]): Pick<O, K> {
2 const result: any = {}
3
4 for (const key of keys) {
5 if (Object.prototype.hasOwnProperty.call(object, key)) {
6 result[key] = object[key]
7 }
8 }
9
10 return result
11 }
12
13 export {
14 pick
15 }