filter

Full name: taxi.stdlib.filter

Signature

declare extension function <T> filter(collection:T[], callback: (T) -> Boolean):T[]

Description

Returns a new collection containing only the members of the original collection that match the provided predicate.

This function is used to select a subset of elements from a collection based on a condition.

find { store: Store } as {
   allProducts: store.products // all products
   inStockProducts: store.products.filter((product) -> product.stockLevel > 0)
   affordableProducts: store.products.filter((product) -> product.price < 50.00)
}

Examples

Filters a collection by predicate, returning only matching elements. Uses type-based lambda for clean, semantic access.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi