npm.io
2.13.0 • Published 5 years ago

@unction/get

Licence
SEE LICENSE IN LICENSE
Version
2.13.0
Deps
2
Size
15 kB
Vulns
0
Weekly
0

@unction/get

Tests Stability Dependencies

KeyType => unknown => ValueType

Returns the value of a specific key on an iterable. If no key is found it returns undefined. If the second argument isn't an iterable we return undefined, to allow for graceful failure.

get("aaa")({aaa: "1"}) // "1"
get("bbb")({aaa: "1"}) // undefined
get("bbb")(undefined) // undefined
get(0)(["aaa"]) // "aaa"