Boolean Functions
binary
ts
bool.binary(): intReturns an integer 1 if the receiver is true, 0 otherwise
Input Example:
textwire
{{ true.binary() }}
{{ false.binary() }}Output:
html
1
0then
ts
bool.then(consequence: any, alternative?: any = nil): anyReturns the consequence if the receiver is true, otherwise returns the alternative. The alternative is optional and defaults to nil
Arguments:
consequence(any) - The value to return if the receiver is truealternative(any) - The value to return if the receiver is false. Default isnil, which will be converted to an empty string when rendered in the template
Input Example:
textwire
{{ true.then("Yes", "No") }}
{{ false.then("Yes", "No") }}
{{ false.then("Yes") }}Output:
html
Yes
No