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

Function copyElement

lib/test/angular/1.7.0/angular.js:1036–1067  ·  view source on GitHub ↗
(source, maxDepth)

Source from the content-addressed store, hash-verified

1034 }
1035
1036 function copyElement(source, maxDepth) {
1037 // Simple values
1038 if (!isObject(source)) {
1039 return source;
1040 }
1041
1042 // Already copied values
1043 var index = stackSource.indexOf(source);
1044 if (index !== -1) {
1045 return stackDest[index];
1046 }
1047
1048 if (isWindow(source) || isScope(source)) {
1049 throw ngMinErr('cpws',
1050 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
1051 }
1052
1053 var needsRecurse = false;
1054 var destination = copyType(source);
1055
1056 if (destination === undefined) {
1057 destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
1058 needsRecurse = true;
1059 }
1060
1061 stackSource.push(source);
1062 stackDest.push(destination);
1063
1064 return needsRecurse
1065 ? copyRecurse(source, destination, maxDepth)
1066 : destination;
1067 }
1068
1069 function copyType(source) {
1070 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