Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function merger(a, b) {
if (b === void 0) {
return nanoclone(a);
}
var type = determineType(a, b);
if (!type) {
return nanoclone(b);
}
var strategy = config.strategy[type.name] || type.default;
return type.merge[strategy](merger, a, b);
}
function merger(a, b) {
if (b === void 0) {
return nanoclone(a);
}
var type = determineType(a, b);
if (!type) {
return nanoclone(b);
}
var strategy = config.strategy[type.name] || type.default;
return type.merge[strategy](merger, a, b);
}
function merger(a, b) {
if (b === void 0) {
return nanoclone(a);
}
var type = determineType(a, b);
if (!type) {
return nanoclone(b);
}
var strategy = config.strategy[type.name] || type.default;
return type.merge[strategy](merger, a, b);
}
replace: function replace(merger, a, b) {
return nanoclone(b);
},
function merger(a, b) {
if (b === void 0) {
return nanoclone(a);
}
var type = determineType(a, b);
if (!type) {
return nanoclone(b);
}
var strategy = config.strategy[type.name] || type.default;
return type.merge[strategy](merger, a, b);
}
replace: function replace(merger, a, b) {
return nanoclone(b);
},
function set(force, elements) {
return force ? nanoclone(elements) : elements;
}
step(a, b) {
if (b === undefined) {
return this.config.force ? nanoclone(a) : a;
}
const type = this.determineType(a, b);
if (!type) {
return this.config.force ? nanoclone(b) : b;
}
const strategy = this.config.strategy[type.name] || type.default;
const merge = this.step.bind(this);
const config = { force: this.config.force };
return type.merge[strategy](merge, config, a, b);
}
export function defaults(def, obj) {
return Object.keys(obj).reduce(function(res, key) {
res[key] = obj[key] || res[key]
return res
}, clone(def))
}
step(a, b) {
if (b === undefined) {
return this.config.force ? nanoclone(a) : a;
}
const type = this.determineType(a, b);
if (!type) {
return this.config.force ? nanoclone(b) : b;
}
const strategy = this.config.strategy[type.name] || type.default;
const merge = this.step.bind(this);
const config = { force: this.config.force };
return type.merge[strategy](merge, config, a, b);
}