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

Function shallowCopy

lib/test/angular/1.4.3/angular.js:963–981  ·  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

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

Callers 9

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

Calls 2

isObjectFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected