Like
extend
but recursively copies only the missing properties/values to the target object.
Originally created by Jon Schlinkert. I do not take any credit for their work.
This fork includes bug fixes, especially with arrays and undefined
or null
values.
Install with NPM.
$ npm i QSmally/defaults-deep
const defaults = require("defaults-deep");
defaults({a: {one: "one"}}, {a: {two: "two"}});
//=> {a: {one: "one", two: "two"}};