MCPcopy
hub / github.com/angular-ui/ui-router / copyRecurse

Function copyRecurse

test/angular/1.4/angular.js:915–944  ·  view source on GitHub ↗
(source, destination)

Source from the content-addressed store, hash-verified

913 return copyElement(source);
914
915 function copyRecurse(source, destination) {
916 var h = destination.$$hashKey;
917 var result, key;
918 if (isArray(source)) {
919 for (var i = 0, ii = source.length; i < ii; i++) {
920 destination.push(copyElement(source[i]));
921 }
922 } else if (isBlankObject(source)) {
923 // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
924 for (key in source) {
925 destination[key] = copyElement(source[key]);
926 }
927 } else if (source && typeof source.hasOwnProperty === 'function') {
928 // Slow path, which must rely on hasOwnProperty
929 for (key in source) {
930 if (source.hasOwnProperty(key)) {
931 destination[key] = copyElement(source[key]);
932 }
933 }
934 } else {
935 // Slowest path --- hasOwnProperty can't be called as a method
936 for (key in source) {
937 if (hasOwnProperty.call(source, key)) {
938 destination[key] = copyElement(source[key]);
939 }
940 }
941 }
942 setHashKey(destination, h);
943 return destination;
944 }
945
946 function copyElement(source) {
947 // Simple values

Callers 2

copyFunction · 0.70
copyElementFunction · 0.70

Calls 4

isArrayFunction · 0.85
copyElementFunction · 0.70
isBlankObjectFunction · 0.70
setHashKeyFunction · 0.70

Tested by

no test coverage detected