Safe deep property access in 120 bytes. x = dlv(obj, 'a.b.x')
Safe deep property access in 120 bytes. x = dlv(obj, 'a.b.x')
dlv(obj, keypath) Safely get a dot-notated path within a nested object, with ability to return a default if the full key path does not exist or the value is undefined
Smallest possible implementation: only 120 bytes.
You could write this yourself, but then you'd have to write tests.
Supports ES Modules, CommonJS and globals.
npm install --save dlv
delve(object, keypath, [default])
…dlv and very fast.dlv and is implemented in a very similar manner.No open issues yet, or sync has not completed.