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

Function shallowCopy

lib/test/angular/1.8.0/angular.js:2656–2674  ·  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

2654 * Assumes that there are no proto properties for objects.
2655 */
2656function shallowCopy(src, dst) {
2657 if (isArray(src)) {
2658 dst = dst || [];
2659
2660 for (var i = 0, ii = src.length; i < ii; i++) {
2661 dst[i] = src[i];
2662 }
2663 } else if (isObject(src)) {
2664 dst = dst || {};
2665
2666 for (var key in src) {
2667 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
2668 dst[key] = src[key];
2669 }
2670 }
2671 }
2672
2673 return dst || src;
2674}
2675
2676/* exported toDebugString */
2677

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.70
isObjectFunction · 0.70

Tested by

no test coverage detected