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

Function copyElement

test/angular/1.5/angular.js:948–979  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

946 }
947
948 function copyElement(source) {
949 // Simple values
950 if (!isObject(source)) {
951 return source;
952 }
953
954 // Already copied values
955 var index = stackSource.indexOf(source);
956 if (index !== -1) {
957 return stackDest[index];
958 }
959
960 if (isWindow(source) || isScope(source)) {
961 throw ngMinErr('cpws',
962 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
963 }
964
965 var needsRecurse = false;
966 var destination = copyType(source);
967
968 if (destination === undefined) {
969 destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
970 needsRecurse = true;
971 }
972
973 stackSource.push(source);
974 stackDest.push(destination);
975
976 return needsRecurse
977 ? copyRecurse(source, destination)
978 : destination;
979 }
980
981 function copyType(source) {
982 switch (toString.call(source)) {

Callers 3

copyFunction · 0.70
copyRecurseFunction · 0.70
copyTypeFunction · 0.70

Calls 6

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

Tested by

no test coverage detected