MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / assign

Function assign

MathBox/mathbox-bundle.js:36813–36838  ·  view source on GitHub ↗
(object, source, guard)

Source from the content-addressed store, hash-verified

36811 * // => { 'name': 'barney', 'employer': 'slate' }
36812 */
36813 var assign = function(object, source, guard) {
36814 var index, iterable = object, result = iterable;
36815 if (!iterable) return result;
36816 var args = arguments,
36817 argsIndex = 0,
36818 argsLength = typeof guard == 'number' ? 2 : args.length;
36819 if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {
36820 var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);
36821 } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {
36822 callback = args[--argsLength];
36823 }
36824 while (++argsIndex < argsLength) {
36825 iterable = args[argsIndex];
36826 if (iterable && objectTypes[typeof iterable]) {
36827 var ownIndex = -1,
36828 ownProps = objectTypes[typeof iterable] && keys(iterable),
36829 length = ownProps ? ownProps.length : 0;
36830
36831 while (++ownIndex < length) {
36832 index = ownProps[ownIndex];
36833 result[index] = callback ? callback(result[index], iterable[index]) : iterable[index];
36834 }
36835 }
36836 }
36837 return result
36838 };
36839
36840 /**
36841 * Creates a clone of `value`. If `isDeep` is `true` nested objects will also

Callers 2

baseCloneFunction · 0.85
createFunction · 0.85

Calls 2

baseCreateCallbackFunction · 0.85
callbackFunction · 0.70

Tested by

no test coverage detected