setup-maven-cached/node_modules/underscore/amd/_createAssigner.js

25 lines
656 B
JavaScript
Raw Permalink Normal View History

2022-06-28 16:39:30 +08:00
define(function () {
// An internal function for creating assigner functions.
function createAssigner(keysFunc, defaults) {
return function(obj) {
var length = arguments.length;
if (defaults) obj = Object(obj);
if (length < 2 || obj == null) return obj;
for (var index = 1; index < length; index++) {
var source = arguments[index],
keys = keysFunc(source),
l = keys.length;
for (var i = 0; i < l; i++) {
var key = keys[i];
if (!defaults || obj[key] === void 0) obj[key] = source[key];
}
}
return obj;
};
}
return createAssigner;
});