4 ms·
But it isn't one line: var clone = require('clone'); module.exports = function(options, defaults) { options = options || {}; Object.keys(de
by franciscop 11y ago
But it isn't one line:
var clone = require('clone');
module.exports = function(options, defaults) {
options = options || {};
Object.keys(defaults).forEach(function(key) {
if (typeof options[key] === 'undefined') {
options[key] = clone(defaults[key]);
}
});
return options;
};
Besides the tests and the fact that someone is maintaining it. It's not much, but it's code that doesn't have to be maintained by you