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

Function shallowCopy

test/angular/1.2/angular.js:929–947  ·  view source on GitHub ↗

* Creates a shallow copy of an object, an array or a primitive

(src, dst)

Source from the content-addressed store, hash-verified

927 * Creates a shallow copy of an object, an array or a primitive
928 */
929function shallowCopy(src, dst) {
930 if (isArray(src)) {
931 dst = dst || [];
932
933 for ( var i = 0; i < src.length; i++) {
934 dst[i] = src[i];
935 }
936 } else if (isObject(src)) {
937 dst = dst || {};
938
939 for (var key in src) {
940 if (hasOwnProperty.call(src, key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
941 dst[key] = src[key];
942 }
943 }
944 }
945
946 return dst || src;
947}
948
949
950/**

Callers 8

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

Calls 2

isArrayFunction · 0.85
isObjectFunction · 0.70

Tested by

no test coverage detected