* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 840 | * Assumes that there are no proto properties for objects. |
| 841 | */ |
| 842 | function shallowCopy(src, dst) { |
| 843 | if (isArray(src)) { |
| 844 | dst = dst || []; |
| 845 | |
| 846 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 847 | dst[i] = src[i]; |
| 848 | } |
| 849 | } else if (isObject(src)) { |
| 850 | dst = dst || {}; |
| 851 | |
| 852 | for (var key in src) { |
| 853 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 854 | dst[key] = src[key]; |
| 855 | } |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | return dst || src; |
| 860 | } |
| 861 | |
| 862 | |
| 863 | /** |
no test coverage detected