MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / copyRecurse

Function copyRecurse

lib/test/angular/1.5.0/angular.js:889–918  ·  view source on GitHub ↗
(source, destination)

Source from the content-addressed store, hash-verified

887 return copyElement(source);
888
889 function copyRecurse(source, destination) {
890 var h = destination.$$hashKey;
891 var result, key;
892 if (isArray(source)) {
893 for (var i = 0, ii = source.length; i < ii; i++) {
894 destination.push(copyElement(source[i]));
895 }
896 } else if (isBlankObject(source)) {
897 // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
898 for (key in source) {
899 destination[key] = copyElement(source[key]);
900 }
901 } else if (source && typeof source.hasOwnProperty === 'function') {
902 // Slow path, which must rely on hasOwnProperty
903 for (key in source) {
904 if (source.hasOwnProperty(key)) {
905 destination[key] = copyElement(source[key]);
906 }
907 }
908 } else {
909 // Slowest path --- hasOwnProperty can't be called as a method
910 for (key in source) {
911 if (hasOwnProperty.call(source, key)) {
912 destination[key] = copyElement(source[key]);
913 }
914 }
915 }
916 setHashKey(destination, h);
917 return destination;
918 }
919
920 function copyElement(source) {
921 // Simple values

Callers 2

copyFunction · 0.70
copyElementFunction · 0.70

Calls 4

copyElementFunction · 0.70
isBlankObjectFunction · 0.70
setHashKeyFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected