* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 856 | * Assumes that there are no proto properties for objects. |
| 857 | */ |
| 858 | function shallowCopy(src, dst) { |
| 859 | if (isArray(src)) { |
| 860 | dst = dst || []; |
| 861 | |
| 862 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 863 | dst[i] = src[i]; |
| 864 | } |
| 865 | } else if (isObject(src)) { |
| 866 | dst = dst || {}; |
| 867 | |
| 868 | for (var key in src) { |
| 869 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 870 | dst[key] = src[key]; |
| 871 | } |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | return dst || src; |
| 876 | } |
| 877 | |
| 878 | |
| 879 | /** |
no test coverage detected