MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / createAssigner

Function createAssigner

lib/web/jshint.js:4582–4609  ·  view source on GitHub ↗

* Creates a function that assigns properties of source object(s) to a given * destination object. * * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. * * @private * @param {Function} assigner The function to assign values. * @retu

(assigner)

Source from the content-addressed store, hash-verified

4580 * @returns {Function} Returns the new assigner function.
4581 */
4582 function createAssigner(assigner) {
4583 return restParam(function(object, sources) {
4584 var index = -1,
4585 length = object == null ? 0 : sources.length,
4586 customizer = length > 2 && sources[length - 2],
4587 guard = length > 2 && sources[2],
4588 thisArg = length > 1 && sources[length - 1];
4589
4590 if (typeof customizer == 'function') {
4591 customizer = bindCallback(customizer, thisArg, 5);
4592 length -= 2;
4593 } else {
4594 customizer = typeof thisArg == 'function' ? thisArg : null;
4595 length -= (customizer ? 1 : 0);
4596 }
4597 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
4598 customizer = length < 3 ? null : customizer;
4599 length = 1;
4600 }
4601 while (++index < length) {
4602 var source = sources[index];
4603 if (source) {
4604 assigner(object, source, customizer);
4605 }
4606 }
4607 return object;
4608 });
4609 }
4610
4611 /**
4612 * Creates a `baseEach` or `baseEachRight` function.

Callers 1

runInContextFunction · 0.85

Calls 3

restParamFunction · 0.85
bindCallbackFunction · 0.85
isIterateeCallFunction · 0.85

Tested by

no test coverage detected