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

Function shallowCopy

lib/test/angular/1.7.0/angular.js:2596–2614  ·  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

2594 * Assumes that there are no proto properties for objects.
2595 */
2596function shallowCopy(src, dst) {
2597 if (isArray(src)) {
2598 dst = dst || [];
2599
2600 for (var i = 0, ii = src.length; i < ii; i++) {
2601 dst[i] = src[i];
2602 }
2603 } else if (isObject(src)) {
2604 dst = dst || {};
2605
2606 for (var key in src) {
2607 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
2608 dst[key] = src[key];
2609 }
2610 }
2611 }
2612
2613 return dst || src;
2614}
2615
2616/* exported toDebugString */
2617

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