MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / copyElement

Function copyElement

lib/test/angular/1.5.0/angular.js:920–951  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

918 }
919
920 function copyElement(source) {
921 // Simple values
922 if (!isObject(source)) {
923 return source;
924 }
925
926 // Already copied values
927 var index = stackSource.indexOf(source);
928 if (index !== -1) {
929 return stackDest[index];
930 }
931
932 if (isWindow(source) || isScope(source)) {
933 throw ngMinErr('cpws',
934 "Can't copy! Making copies of Window or Scope instances is not supported.");
935 }
936
937 var needsRecurse = false;
938 var destination = copyType(source);
939
940 if (destination === undefined) {
941 destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
942 needsRecurse = true;
943 }
944
945 stackSource.push(source);
946 stackDest.push(destination);
947
948 return needsRecurse
949 ? copyRecurse(source, destination)
950 : destination;
951 }
952
953 function copyType(source) {
954 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