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

Function shallowCopy

test/angular/1.7/angular.js:2635–2653  ·  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

2633 * Assumes that there are no proto properties for objects.
2634 */
2635function shallowCopy(src, dst) {
2636 if (isArray(src)) {
2637 dst = dst || [];
2638
2639 for (var i = 0, ii = src.length; i < ii; i++) {
2640 dst[i] = src[i];
2641 }
2642 } else if (isObject(src)) {
2643 dst = dst || {};
2644
2645 for (var key in src) {
2646 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
2647 dst[key] = src[key];
2648 }
2649 }
2650 }
2651
2652 return dst || src;
2653}
2654
2655/* exported toDebugString */
2656

Callers 8

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

Calls 2

isArrayFunction · 0.85
isObjectFunction · 0.70

Tested by

no test coverage detected