MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / shallowCopy

Function shallowCopy

lib/test/angular/1.6.7/angular.js:2621–2639  ·  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

2619 * Assumes that there are no proto properties for objects.
2620 */
2621function shallowCopy(src, dst) {
2622 if (isArray(src)) {
2623 dst = dst || [];
2624
2625 for (var i = 0, ii = src.length; i < ii; i++) {
2626 dst[i] = src[i];
2627 }
2628 } else if (isObject(src)) {
2629 dst = dst || {};
2630
2631 for (var key in src) {
2632 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
2633 dst[key] = src[key];
2634 }
2635 }
2636 }
2637
2638 return dst || src;
2639}
2640
2641/* exported toDebugString */
2642

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

isObjectFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected