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
Why?
Smallest possible implementation: only 130 bytes.
You could write this yourself, but then you'd have to write tests.
Supports ES Modules, CommonJS and globals.
Installation
npm install --save dlv
Usage
delve(object, keypath, [default])
; let obj = a: b: c: 1 d: undefined e: null ; //use string dot notation for keys === 1; //or use an array key === 1; === objab; //returns undefined if the full key path does not exist and no default is specified === undefined; //optional third parameter for default if the full key in path is missing === 'foo'; //or if the key exists but the value is undefined === 'foo'; //Non-truthy defined values are still returned if they exist at the full keypath === null; //undefined obj or key returns undefined, unless a default is supplied === undefined; === 'foo'; === 'foo';Setter Counterparts
- dset by @lukeed is the spiritual "set" counterpart of
dlvand very fast. - bury by @kalmbach does the opposite of
dlvand is implemented in a very similar manner.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
