* Creates a shallow copy of an object, an array or a primitive. * * Assumes that there are no proto properties for objects.
(src, dst)
| 997 | * Assumes that there are no proto properties for objects. |
| 998 | */ |
| 999 | function shallowCopy(src, dst) { |
| 1000 | if (isArray(src)) { |
| 1001 | dst = dst || []; |
| 1002 | |
| 1003 | for (var i = 0, ii = src.length; i < ii; i++) { |
| 1004 | dst[i] = src[i]; |
| 1005 | } |
| 1006 | } else if (isObject(src)) { |
| 1007 | dst = dst || {}; |
| 1008 | |
| 1009 | for (var key in src) { |
| 1010 | if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) { |
| 1011 | dst[key] = src[key]; |
| 1012 | } |
| 1013 | } |
| 1014 | } |
| 1015 | |
| 1016 | return dst || src; |
| 1017 | } |
| 1018 | |
| 1019 | |
| 1020 | /** |
no test coverage detected