npm.io
1.14.0 • Published 5 years ago

@unction/dig

Licence
SEE LICENSE IN LICENSE
Version
1.14.0
Deps
3
Size
15 kB
Vulns
0
Weekly
0

@unction/dig

Tests Stability Dependencies

Array => B => C

Takes a chain of keys and a tree, traversing down and reaching the last value. If any part of the chain is undefined or not an object the result will always be undefined.

dig(["aaa", "bbb", "ccc"])({aaa: {bbb: {ccc: "1"}}}) // "1"
dig(["aaa", "ddd", "ccc"])({aaa: {bbb: {ccc: "1"}}}) // undefined

Keywords