MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / baseExtend

Function baseExtend

lib/test/angular/1.5.0/angular.js:397–429  ·  view source on GitHub ↗
(dst, objs, deep)

Source from the content-addressed store, hash-verified

395
396
397function baseExtend(dst, objs, deep) {
398 var h = dst.$$hashKey;
399
400 for (var i = 0, ii = objs.length; i < ii; ++i) {
401 var obj = objs[i];
402 if (!isObject(obj) && !isFunction(obj)) continue;
403 var keys = Object.keys(obj);
404 for (var j = 0, jj = keys.length; j < jj; j++) {
405 var key = keys[j];
406 var src = obj[key];
407
408 if (deep && isObject(src)) {
409 if (isDate(src)) {
410 dst[key] = new Date(src.valueOf());
411 } else if (isRegExp(src)) {
412 dst[key] = new RegExp(src);
413 } else if (src.nodeName) {
414 dst[key] = src.cloneNode(true);
415 } else if (isElement(src)) {
416 dst[key] = src.clone();
417 } else {
418 if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
419 baseExtend(dst[key], [src], true);
420 }
421 } else {
422 dst[key] = src;
423 }
424 }
425 }
426
427 setHashKey(dst, h);
428 return dst;
429}
430
431/**
432 * @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
setHashKeyFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected