Version: v0.7.1 - Beta.  We welcome contributors & feedback.

List.filter

filter($callbackFunction) -> list

Description

Keep or remove items in the List.

If the callback returns true, the item is kept in the List. Otherwise, it is removed.

Returns a List of filtered items.

(This example uses Expression Function notation x{...}.)

[1, -2, 3, -4, 5].filter(x{ $a > 0 })
//= [1, 3, 5]

See Also