* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 2619 | * Assumes that there are no proto properties for objects. |
| 2620 | */ |
| 2621 | function shallowCopy(src, dst) { |
| 2622 | if (isArray(src)) { |
| 2623 | dst = dst || []; |
| 2624 | |
| 2625 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 2626 | dst[i] = src[i]; |
| 2627 | } |
| 2628 | } else if (isObject(src)) { |
| 2629 | dst = dst || {}; |
| 2630 | |
| 2631 | for (var key in src) { |
| 2632 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 2633 | dst[key] = src[key]; |
| 2634 | } |
| 2635 | } |
| 2636 | } |
| 2637 | |
| 2638 | return dst || src; |
| 2639 | } |
| 2640 | |
| 2641 | /* exported toDebugString */ |
| 2642 |
no test coverage detected