skip until for filters

Skip elements of the input until a predicate is true.

Signature

> skip until (predicate)

Parameters

  • predicate: the predicate that skipped element must not match

Examples

Skip until the element is positive

> [-2 0 2 -1] | skip until {|x| $x > 0 }
╭───┬────╮
│ 02 │
│ 1-1 │
╰───┴────╯

Skip until the element is positive using stored condition

> let cond = {|x| $x > 0 }; [-2 0 2 -1] | skip until $cond
╭───┬────╮
│ 02 │
│ 1-1 │
╰───┴────╯

Skip until the field value is positive

> [{a: -2} {a: 0} {a: 2} {a: -1}] | skip until {|x| $x.a > 0 }
╭───┬────╮
│ # │ a  │
├───┼────┤
│ 02 │
│ 1-1 │
╰───┴────╯