MCPcopy
hub / github.com/binux/qiandao / shallowCopy

Function shallowCopy

web/static/components/angularjs/angular.js:923–941  ·  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

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

Callers 8

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

Calls 2

isArrayFunction · 0.85
isObjectFunction · 0.70

Tested by

no test coverage detected