* Merges two objects. Values from obj2 override values in obj1. * Function is NOT recursive and works only for one dimensional objects. * @param {Object} obj1 First object. * @param {Object} obj2 Second object. * @return {Object} Returns combination of both objects.
(obj1, obj2)
| 556 | * @return {Object} Returns combination of both objects. |
| 557 | */ |
| 558 | function merge(obj1, obj2) |
| 559 | { |
| 560 | var result = {}, name; |
| 561 | |
| 562 | for (name in obj1) |
| 563 | result[name] = obj1[name]; |
| 564 | |
| 565 | for (name in obj2) |
| 566 | result[name] = obj2[name]; |
| 567 | |
| 568 | return result; |
| 569 | }; |
| 570 | |
| 571 | /** |
| 572 | * Attempts to convert string to boolean. |