set-options
Merges default options to the user-given options.
Install
$ npm install set-options --save
set(options, defaults)
Always returns an object. For a key k
, if options
does not have k
as an own property, and defaults
does, defaults[k]
will copied to options
.
var set = var defaults = a: 1 { var config = // `options` and `defaults` will not be ruined after `set()` console} // {a: 1} false false // {a: 1} false false // {a: 1} false false // {a: 1} false false // {a: 1} false false // {a: 1, b: 1} false false // {a: 0} false false
- options
Object=
can be undefined. - defaults
Object
not definingdefaults
is silly, since that's the whole purpose of this lib.
Define whether should override properties
let options = options // {a: undefined}
Deep merge? Nope
Do something below instead.
options = optionsconfig =
License
MIT