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

Function copyRecurse

lib/test/angular/1.6.7/angular.js:1033–1066  ·  view source on GitHub ↗
(source, destination, maxDepth)

Source from the content-addressed store, hash-verified

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

Callers 2

copyFunction · 0.70
copyElementFunction · 0.70

Calls 4

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

Tested by

no test coverage detected