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

Function copyElement

lib/test/angular/1.8.0/angular.js:1076–1107  ·  view source on GitHub ↗
(source, maxDepth)

Source from the content-addressed store, hash-verified

1074 }
1075
1076 function copyElement(source, maxDepth) {
1077 // Simple values
1078 if (!isObject(source)) {
1079 return source;
1080 }
1081
1082 // Already copied values
1083 var index = stackSource.indexOf(source);
1084 if (index !== -1) {
1085 return stackDest[index];
1086 }
1087
1088 if (isWindow(source) || isScope(source)) {
1089 throw ngMinErr('cpws',
1090 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
1091 }
1092
1093 var needsRecurse = false;
1094 var destination = copyType(source);
1095
1096 if (destination === undefined) {
1097 destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
1098 needsRecurse = true;
1099 }
1100
1101 stackSource.push(source);
1102 stackDest.push(destination);
1103
1104 return needsRecurse
1105 ? copyRecurse(source, destination, maxDepth)
1106 : destination;
1107 }
1108
1109 function copyType(source) {
1110 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
isArrayFunction · 0.70
copyRecurseFunction · 0.70

Tested by

no test coverage detected