* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 961 | * Assumes that there are no proto properties for objects. |
| 962 | */ |
| 963 | function 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 | /** |
no test coverage detected