Atom

assert()

Checks a value's truthiness.

Signature

assert(condition[, error])

Parameters

Any condition value, and an optional thrown value. Default error text is 'assertion failed'.

Returns

The same condition value when truthy.

Behavior

The arguments are evaluated normally before the call.

Errors

Throws the supplied value or the default error when condition is false or null.

Example

Atom
assert(count([1]) == 1, 'expected one item')