aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/core-utils/utils/object.ts
blob: 9a8a98f9b9fc90c815d1185f88521338387fb266 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

                                                                                        












                                                            
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
}