* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 975 | * Assumes that there are no proto properties for objects. |
| 976 | */ |
| 977 | function shallowCopy(src, dst) { |
| 978 | if (isArray(src)) { |
| 979 | dst = dst || []; |
| 980 | |
| 981 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 982 | dst[i] = src[i]; |
| 983 | } |
| 984 | } else if (isObject(src)) { |
| 985 | dst = dst || {}; |
| 986 | |
| 987 | for (var key in src) { |
| 988 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 989 | dst[key] = src[key]; |
| 990 | } |
| 991 | } |
| 992 | } |
| 993 | |
| 994 | return dst || src; |
| 995 | } |
| 996 | |
| 997 | /** |
| 998 | * @ngdoc function |
no test coverage detected