* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 2409 | * Assumes that there are no proto properties for objects. |
| 2410 | */ |
| 2411 | function shallowCopy(src, dst) { |
| 2412 | if (isArray(src)) { |
| 2413 | dst = dst || []; |
| 2414 | |
| 2415 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 2416 | dst[i] = src[i]; |
| 2417 | } |
| 2418 | } else if (isObject(src)) { |
| 2419 | dst = dst || {}; |
| 2420 | |
| 2421 | for (var key in src) { |
| 2422 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 2423 | dst[key] = src[key]; |
| 2424 | } |
| 2425 | } |
| 2426 | } |
| 2427 | |
| 2428 | return dst || src; |
| 2429 | } |
| 2430 | |
| 2431 | /* global toDebugString: true */ |
| 2432 |
no test coverage detected