Sha256: bd3d32efdf231b075b4284b4658c41ac1956aad3cc5575992eab4c1d28280e2d
Contents?: true
Size: 1.14 KB
Versions: 14
Compression:
Stored size: 1.14 KB
Contents
var bindCallback = require('./bindCallback'), isIterateeCall = require('./isIterateeCall'); /** * Creates a function that assigns properties of source object(s) to a given * destination object. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return function() { var length = arguments.length, object = arguments[0]; if (length < 2 || object == null) { return object; } if (length > 3 && isIterateeCall(arguments[1], arguments[2], arguments[3])) { length = 2; } // Juggle arguments. if (length > 3 && typeof arguments[length - 2] == 'function') { var customizer = bindCallback(arguments[--length - 1], arguments[length--], 5); } else if (length > 2 && typeof arguments[length - 1] == 'function') { customizer = arguments[--length]; } var index = 0; while (++index < length) { var source = arguments[index]; if (source) { assigner(object, source, customizer); } } return object; }; } module.exports = createAssigner;
Version data entries
14 entries across 7 versions & 1 rubygems