* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 2635 | * Assumes that there are no proto properties for objects. |
| 2636 | */ |
| 2637 | function shallowCopy(src, dst) { |
| 2638 | if (isArray(src)) { |
| 2639 | dst = dst || []; |
| 2640 | |
| 2641 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 2642 | dst[i] = src[i]; |
| 2643 | } |
| 2644 | } else if (isObject(src)) { |
| 2645 | dst = dst || {}; |
| 2646 | |
| 2647 | for (var key in src) { |
| 2648 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 2649 | dst[key] = src[key]; |
| 2650 | } |
| 2651 | } |
| 2652 | } |
| 2653 | |
| 2654 | return dst || src; |
| 2655 | } |
| 2656 | |
| 2657 | /* exported toDebugString */ |
| 2658 |
no test coverage detected