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

Function copyRecurse

OpenReservation/wwwroot/Scripts/angular.js:868–897  ·  view source on GitHub ↗
(source, destination)

Source from the content-addressed store, hash-verified

866 return copyElement(source);
867
868 function copyRecurse(source, destination) {
869 var h = destination.$$hashKey;
870 var result, key;
871 if (isArray(source)) {
872 for (var i = 0, ii = source.length; i < ii; i++) {
873 destination.push(copyElement(source[i]));
874 }
875 } else if (isBlankObject(source)) {
876 // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
877 for (key in source) {
878 destination[key] = copyElement(source[key]);
879 }
880 } else if (source && typeof source.hasOwnProperty === 'function') {
881 // Slow path, which must rely on hasOwnProperty
882 for (key in source) {
883 if (source.hasOwnProperty(key)) {
884 destination[key] = copyElement(source[key]);
885 }
886 }
887 } else {
888 // Slowest path --- hasOwnProperty can't be called as a method
889 for (key in source) {
890 if (hasOwnProperty.call(source, key)) {
891 destination[key] = copyElement(source[key]);
892 }
893 }
894 }
895 setHashKey(destination, h);
896 return destination;
897 }
898
899 function copyElement(source) {
900 // Simple values

Callers 2

copyFunction · 0.85
copyElementFunction · 0.85

Calls 3

copyElementFunction · 0.85
isBlankObjectFunction · 0.85
setHashKeyFunction · 0.85

Tested by

no test coverage detected