* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 2594 | * Assumes that there are no proto properties for objects. |
| 2595 | */ |
| 2596 | function shallowCopy(src, dst) { |
| 2597 | if (isArray(src)) { |
| 2598 | dst = dst || []; |
| 2599 | |
| 2600 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 2601 | dst[i] = src[i]; |
| 2602 | } |
| 2603 | } else if (isObject(src)) { |
| 2604 | dst = dst || {}; |
| 2605 | |
| 2606 | for (var key in src) { |
| 2607 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 2608 | dst[key] = src[key]; |
| 2609 | } |
| 2610 | } |
| 2611 | } |
| 2612 | |
| 2613 | return dst || src; |
| 2614 | } |
| 2615 | |
| 2616 | /* exported toDebugString */ |
| 2617 |
no test coverage detected