deno.land / x / rambda@v9.1.1 / source / pickAll.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { createPath } from './_internals/createPath.js'
export function pickAll(propsToPick, obj){ if (arguments.length === 1) return _obj => pickAll(propsToPick, _obj)
if (obj === null || obj === undefined){ return undefined } const keysValue = createPath(propsToPick, ',') const willReturn = {} let counter = 0
while (counter < keysValue.length){ if (keysValue[ counter ] in obj){ willReturn[ keysValue[ counter ] ] = obj[ keysValue[ counter ] ] } else { willReturn[ keysValue[ counter ] ] = undefined } counter++ }
return willReturn}
rambda

Version Info

Tagged at
7 months ago