# Function filter

- filter<T>(iterable, p): Iterable<T>

- The equivalent of Array.prototype.filter for iterators.

  #### Type Parameters

  - T

  #### Parameters

  - iterable: Iterable<T, any, any>

    The iterator to filter.

  - p: ((x: T, index?: number) => boolean)

    The filter predicate.

    - - (x, index?): boolean

      - #### Parameters

        - x: T
        - `Optional` index: number

        #### Returns boolean

  #### Returns Iterable<T>