skip while for filters

Skip elements of the input while a predicate is true.

Signature

> skip while (predicate)

Parameters

  • predicate: the predicate that skipped element must match

Examples

Skip while the element is negative

> [-2 0 2 -1] | skip while {|x| $x < 0 }
╭───┬────╮
│ 00 │
│ 12 │
│ 2-1 │
╰───┴────╯

Skip while the element is negative using stored condition

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

Skip while the field value is negative

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