* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 2654 | * Assumes that there are no proto properties for objects. |
| 2655 | */ |
| 2656 | function shallowCopy(src, dst) { |
| 2657 | if (isArray(src)) { |
| 2658 | dst = dst || []; |
| 2659 | |
| 2660 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 2661 | dst[i] = src[i]; |
| 2662 | } |
| 2663 | } else if (isObject(src)) { |
| 2664 | dst = dst || {}; |
| 2665 | |
| 2666 | for (var key in src) { |
| 2667 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 2668 | dst[key] = src[key]; |
| 2669 | } |
| 2670 | } |
| 2671 | } |
| 2672 | |
| 2673 | return dst || src; |
| 2674 | } |
| 2675 | |
| 2676 | /* exported toDebugString */ |
| 2677 |
no test coverage detected