MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / shallowCopy

Function shallowCopy

web/static/bower_components/angular/angular.js:967–985  ·  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

965 * Assumes that there are no proto properties for objects.
966 */
967function shallowCopy(src, dst) {
968 if (isArray(src)) {
969 dst = dst || [];
970
971 for (var i = 0, ii = src.length; i < ii; i++) {
972 dst[i] = src[i];
973 }
974 } else if (isObject(src)) {
975 dst = dst || {};
976
977 for (var key in src) {
978 if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
979 dst[key] = src[key];
980 }
981 }
982 }
983
984 return dst || src;
985}
986
987
988/**

Callers 9

eventHandlerFunction · 0.85
angular.jsFile · 0.85
$HttpProviderFunction · 0.85
mergeHeadersFunction · 0.85
sendReqFunction · 0.85
resolvePromiseWithResultFunction · 0.85
$SceProviderFunction · 0.85
ngClassWatchActionFunction · 0.85
selectDirectiveFunction · 0.85

Calls 1

isObjectFunction · 0.85

Tested by

no test coverage detected