Filter

public struct Filter: Fn

Filter applies lambda expr to each member of the Array or Page collection, and returns a new collection of the same type containing only those elements for which lambda expr returned true. If a Page is passed, its cursor is preserved in the result.

Providing a lambda which does not return a Boolean results in an “invalid argument” error.

Reference.

  • Declaration

    Swift

    public init(collection: Expr, with lambda: Expr)

    Parameters

    collection

    Collection to perform filter expression.

    lambda

    Lambda expression to apply to each collection item. Must return a boolean value.

  • Declaration

    Swift

    public init(_ collection: Expr, _ lambda: (Expr) -> Expr)

    Parameters

    collection

    Collection to perform filter expression.

    lambda

    Lambda expression to apply to each collection item. Must return a boolean value.

  • Declaration

    Swift

    public init(_ collection: Expr, _ lambda: ((Expr, Expr)) -> Expr)

    Parameters

    collection

    Collection to perform filter expression.

    lambda

    Lambda expression to apply to each collection item. Must return a boolean value.

  • Declaration

    Swift

    public init(_ collection: Expr, _ lambda: ((Expr, Expr, Expr)) -> Expr)

    Parameters

    collection

    Collection to perform filter expression.

    lambda

    Lambda expression to apply to each collection item. Must return a boolean value.

  • Declaration

    Swift

    public init(_ collection: Expr, _ lambda: ((Expr, Expr, Expr, Expr)) -> Expr)

    Parameters

    collection

    Collection to perform filter expression.

    lambda

    Lambda expression to apply to each collection item. Must return a boolean value.

  • Declaration

    Swift

    public init(_ collection: Expr, _ lambda: ((Expr, Expr, Expr, Expr, Expr)) -> Expr)

    Parameters

    collection

    Collection to perform filter expression.

    lambda

    Lambda expression to apply to each collection item. Must return a boolean value.