* Return a shallow copy of the given object * * @public * @function shallowCopy * @param {Object} obj - the object to copy * @returns {Object} the new copy of the object
(obj)
| 11 | * @returns {Object} the new copy of the object |
| 12 | */ |
| 13 | function shallowCopy(obj) { |
| 14 | if (!obj) { |
| 15 | return obj; |
| 16 | } |
| 17 | var copy = {}; |
| 18 | Object.keys(obj).forEach(function forEach(k) { |
| 19 | copy[k] = obj[k]; |
| 20 | }); |
| 21 | return copy; |
| 22 | } |
| 23 | |
| 24 | ///--- Exports |
| 25 |
no outgoing calls
no test coverage detected