MCPcopy Create free account
hub / github.com/aurelia/binding / autoConvertAdd

Function autoConvertAdd

src/ast.js:709–732  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

707
708/// Add the two arguments with automatic type conversion.
709function 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
734function getFunction(obj, name, mustExist) {
735 let func = obj === null || obj === undefined ? null : obj[name];

Callers 1

evaluateMethod · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected