MCPcopy
hub / github.com/angular-ui/ui-grid / baseExtend

Function baseExtend

lib/test/angular/1.8.0/angular.js:464–498  ·  view source on GitHub ↗
(dst, objs, deep)

Source from the content-addressed store, hash-verified

462
463
464function baseExtend(dst, objs, deep) {
465 var h = dst.$$hashKey;
466
467 for (var i = 0, ii = objs.length; i < ii; ++i) {
468 var obj = objs[i];
469 if (!isObject(obj) && !isFunction(obj)) continue;
470 var keys = Object.keys(obj);
471 for (var j = 0, jj = keys.length; j < jj; j++) {
472 var key = keys[j];
473 var src = obj[key];
474
475 if (deep && isObject(src)) {
476 if (isDate(src)) {
477 dst[key] = new Date(src.valueOf());
478 } else if (isRegExp(src)) {
479 dst[key] = new RegExp(src);
480 } else if (src.nodeName) {
481 dst[key] = src.cloneNode(true);
482 } else if (isElement(src)) {
483 dst[key] = src.clone();
484 } else {
485 if (key !== '__proto__') {
486 if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
487 baseExtend(dst[key], [src], true);
488 }
489 }
490 } else {
491 dst[key] = src;
492 }
493 }
494 }
495
496 setHashKey(dst, h);
497 return dst;
498}
499
500/**
501 * @ngdoc function

Callers 2

extendFunction · 0.70
mergeFunction · 0.70

Calls 7

isObjectFunction · 0.70
isFunctionFunction · 0.70
isDateFunction · 0.70
isRegExpFunction · 0.70
isElementFunction · 0.70
isArrayFunction · 0.70
setHashKeyFunction · 0.70

Tested by

no test coverage detected