bury(obj, keypath, value)
Safely set a dot-notated path within a nested object, return undefined if the full key path does not exist, otherwise return the value set.
Usage
bury(object, keypath, value)
; let obj = a: b: c: 1 d: undefined e: null ; //use string dot notation for keys === 2; //or use an array key === 2; //returns undefined if the full key path does not exist === undefined;
Tests
https://github.com/kalmbach/bury/blob/master/test.js
License
MIT