Tagscript

IntersectionStatementParser

Return the first branch only when every expression is true.

all takes a list of expressions and returns the first branch only if every one of them is true. It is the counterpart to any.

For template authors

Syntax

{all(expression|expression|...):true message|false message}

Examples

Range checks are the common case, since if only compares two values at a time:

{all({n}>=100|{n}<=999):You picked {n}.|Pick a number between 100 and 999.}
# when n is 52
Pick a number between 100 and 999.
# when n is 282
You picked 282.

Aliases

all, and, intersection

For developers

Register the parser

import { Interpreter, IntersectionStatementParser } from 'tagscript';
const ts = new Interpreter(new IntersectionStatementParser());

Behaviour

Both the parameter and the payload are required. Every expression is evaluated, then the results are AND-ed together, with no short circuit.

API reference

IntersectionStatementParser

Last updated on

On this page

Edit on Github