defaults
Assigns enumerable properties of the default object(s) to the destination object for all destination properties that resolve to undefined.
Installation
npm
:
$ npm install stluafed
or component
:
$ component install avetisk/defaults
API
simple: defaults(obj1, obj2)
;// > {'x': 1, 'y': 2, 'z': {'a': 11}}
recursive: defaults(obj1, obj2, true)
;// > {'x': 1, 'y': 2, 'z': {'a': 11, 'b': 22}}
License
MIT