Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 553 Bytes

assert.md

File metadata and controls

32 lines (25 loc) · 553 Bytes

Operator

assert — evaluate an assertion

Synopsis

assert <expr>

Description

The assert operator evaluates the Boolean expression <expr> for each input value, yielding its input value if <expr> evaluates to true or a structured error if it does not.

Examples

echo {a:1} | super -z -c 'assert a > 0' -

=>

{a:1}
echo {a:-1} | super -z -c 'assert a > 0' -

=>

error({message:"assertion failed",expr:"a > 0",on:{a:-1}})