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

Function shallowCopy

test/angular/1.4/angular.js:999–1017  ·  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

997 * Assumes that there are no proto properties for objects.
998 */
999function shallowCopy(src, dst) {
1000 if (isArray(src)) {
1001 dst = dst || [];
1002
1003 for (var i = 0, ii = src.length; i < ii; i++) {
1004 dst[i] = src[i];
1005 }
1006 } else if (isObject(src)) {
1007 dst = dst || {};
1008
1009 for (var key in src) {
1010 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
1011 dst[key] = src[key];
1012 }
1013 }
1014 }
1015
1016 return dst || src;
1017}
1018
1019
1020/**

Callers 9

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

Calls 2

isArrayFunction · 0.85
isObjectFunction · 0.70

Tested by

no test coverage detected