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

Function copyElement

lib/test/angular/1.6.7/angular.js:1068–1099  ·  view source on GitHub ↗
(source, maxDepth)

Source from the content-addressed store, hash-verified

1066 }
1067
1068 function copyElement(source, maxDepth) {
1069 // Simple values
1070 if (!isObject(source)) {
1071 return source;
1072 }
1073
1074 // Already copied values
1075 var index = stackSource.indexOf(source);
1076 if (index !== -1) {
1077 return stackDest[index];
1078 }
1079
1080 if (isWindow(source) || isScope(source)) {
1081 throw ngMinErr('cpws',
1082 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
1083 }
1084
1085 var needsRecurse = false;
1086 var destination = copyType(source);
1087
1088 if (destination === undefined) {
1089 destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
1090 needsRecurse = true;
1091 }
1092
1093 stackSource.push(source);
1094 stackDest.push(destination);
1095
1096 return needsRecurse
1097 ? copyRecurse(source, destination, maxDepth)
1098 : destination;
1099 }
1100
1101 function copyType(source) {
1102 switch (toString.call(source)) {

Callers 3

copyFunction · 0.70
copyRecurseFunction · 0.70
copyTypeFunction · 0.70

Calls 6

isObjectFunction · 0.70
isWindowFunction · 0.70
isScopeFunction · 0.70
copyTypeFunction · 0.70
copyRecurseFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected