| 707 | |
| 708 | /// Add the two arguments with automatic type conversion. |
| 709 | function autoConvertAdd(a, b) { |
| 710 | if (a !== null && b !== null) { |
| 711 | // TODO(deboer): Support others. |
| 712 | if (typeof a === 'string' && typeof b !== 'string') { |
| 713 | return a + b.toString(); |
| 714 | } |
| 715 | |
| 716 | if (typeof a !== 'string' && typeof b === 'string') { |
| 717 | return a.toString() + b; |
| 718 | } |
| 719 | |
| 720 | return a + b; |
| 721 | } |
| 722 | |
| 723 | if (a !== null) { |
| 724 | return a; |
| 725 | } |
| 726 | |
| 727 | if (b !== null) { |
| 728 | return b; |
| 729 | } |
| 730 | |
| 731 | return 0; |
| 732 | } |
| 733 | |
| 734 | function getFunction(obj, name, mustExist) { |
| 735 | let func = obj === null || obj === undefined ? null : obj[name]; |