MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / shallowCopy

Function shallowCopy

code/songhop/www/lib/angular/angular.js:842–860  ·  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

840 * Assumes that there are no proto properties for objects.
841 */
842function shallowCopy(src, dst) {
843 if (isArray(src)) {
844 dst = dst || [];
845
846 for (var i = 0, ii = src.length; i < ii; i++) {
847 dst[i] = src[i];
848 }
849 } else if (isObject(src)) {
850 dst = dst || {};
851
852 for (var key in src) {
853 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
854 dst[key] = src[key];
855 }
856 }
857 }
858
859 return dst || src;
860}
861
862
863/**

Callers 8

eventHandlerFunction · 0.70
angular.jsFile · 0.70
$HttpProviderFunction · 0.70
sendReqFunction · 0.70
resolvePromiseWithResultFunction · 0.70
$SceProviderFunction · 0.70
ngClassWatchActionFunction · 0.70
setupAsMultipleFunction · 0.70

Calls 1

isObjectFunction · 0.70

Tested by

no test coverage detected