any →
guard(
    expression: expression
) → any

Evaluates an expression only when the current input is directly compatible with its entry contract; otherwise, returns the original input unchanged.

Parameters

Name Type Required Description
expression expression Yes Expression evaluated when its entry contract directly accepts the current input.

Argument evaluation

  • expression: Evaluated against the incoming value only when its entry contract accepts that value without coercion.

Behavior

guard checks only whether the current value can enter the supplied expression without coercion. If entry is compatible, the complete expression runs normally, including ordinary coercion between later stages. If entry would require coercion, the expression is skipped and the original value is returned unchanged. The *expression syntax is shorthand for guard(expression).

Examples

"  Bob  " | *trim  "Bob"
"42" | *trim  "42"
"5" | *add(1)  "5"
42 | *trim  42
" Bob " | *(trim | append-space)  "Bob "

Kind: Function
Scope: flow
Aliases: guard


This site uses Just the Docs, a documentation theme for Jekyll.