MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / copyElement

Function copyElement

OpenReservation/wwwroot/Scripts/angular.js:899–930  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

897 }
898
899 function copyElement(source) {
900 // Simple values
901 if (!isObject(source)) {
902 return source;
903 }
904
905 // Already copied values
906 var index = stackSource.indexOf(source);
907 if (index !== -1) {
908 return stackDest[index];
909 }
910
911 if (isWindow(source) || isScope(source)) {
912 throw ngMinErr('cpws',
913 "Can't copy! Making copies of Window or Scope instances is not supported.");
914 }
915
916 var needsRecurse = false;
917 var destination = copyType(source);
918
919 if (destination === undefined) {
920 destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
921 needsRecurse = true;
922 }
923
924 stackSource.push(source);
925 stackDest.push(destination);
926
927 return needsRecurse
928 ? copyRecurse(source, destination)
929 : destination;
930 }
931
932 function copyType(source) {
933 switch (toString.call(source)) {

Callers 3

copyFunction · 0.85
copyRecurseFunction · 0.85
copyTypeFunction · 0.85

Calls 5

isObjectFunction · 0.85
isWindowFunction · 0.85
isScopeFunction · 0.85
copyTypeFunction · 0.85
copyRecurseFunction · 0.85

Tested by

no test coverage detected