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

Function shallowCopy

test/angular/1.6/angular.js:2637–2655  ·  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

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

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