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

Function shallowCopy

OpenReservation/wwwroot/Scripts/angular.js:977–995  ·  view source on GitHub ↗

* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.

(src, dst)

Source from the content-addressed store, hash-verified

975 * Assumes that there are no proto properties for objects.
976 */
977 function shallowCopy(src, dst) {
978 if (isArray(src)) {
979 dst = dst || [];
980
981 for (var i = 0, ii = src.length; i < ii; i++) {
982 dst[i] = src[i];
983 }
984 } else if (isObject(src)) {
985 dst = dst || {};
986
987 for (var key in src) {
988 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
989 dst[key] = src[key];
990 }
991 }
992 }
993
994 return dst || src;
995 }
996
997 /**
998 * @ngdoc function

Callers 9

eventHandlerFunction · 0.85
angular.jsFile · 0.85
$HttpProviderFunction · 0.85
mergeHeadersFunction · 0.85
sendReqFunction · 0.85
resolvePromiseWithResultFunction · 0.85
$SceProviderFunction · 0.85
ngClassWatchActionFunction · 0.85
selectPreLinkFunction · 0.85

Calls 1

isObjectFunction · 0.85

Tested by

no test coverage detected