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

Function copyRecurse

lib/test/angular/1.8.0/angular.js:1041–1074  ·  view source on GitHub ↗
(source, destination, maxDepth)

Source from the content-addressed store, hash-verified

1039 return copyElement(source, maxDepth);
1040
1041 function copyRecurse(source, destination, maxDepth) {
1042 maxDepth--;
1043 if (maxDepth < 0) {
1044 return '...';
1045 }
1046 var h = destination.$$hashKey;
1047 var key;
1048 if (isArray(source)) {
1049 for (var i = 0, ii = source.length; i < ii; i++) {
1050 destination.push(copyElement(source[i], maxDepth));
1051 }
1052 } else if (isBlankObject(source)) {
1053 // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
1054 for (key in source) {
1055 destination[key] = copyElement(source[key], maxDepth);
1056 }
1057 } else if (source && typeof source.hasOwnProperty === 'function') {
1058 // Slow path, which must rely on hasOwnProperty
1059 for (key in source) {
1060 if (source.hasOwnProperty(key)) {
1061 destination[key] = copyElement(source[key], maxDepth);
1062 }
1063 }
1064 } else {
1065 // Slowest path --- hasOwnProperty can't be called as a method
1066 for (key in source) {
1067 if (hasOwnProperty.call(source, key)) {
1068 destination[key] = copyElement(source[key], maxDepth);
1069 }
1070 }
1071 }
1072 setHashKey(destination, h);
1073 return destination;
1074 }
1075
1076 function copyElement(source, maxDepth) {
1077 // Simple values

Callers 2

copyFunction · 0.70
copyElementFunction · 0.70

Calls 4

isArrayFunction · 0.70
copyElementFunction · 0.70
isBlankObjectFunction · 0.70
setHashKeyFunction · 0.70

Tested by

no test coverage detected