Skip to content

fx-flow v0.7.0 / pipe/lazy / filter

Function: filter()

filter(fn, iterable)

filter<A, B>(fn, iterable): IterableIterator<B>

Filter iterable with fn.

Type parameters

A

B

Parameters

fn

iterable: Iterable<A>

Returns

IterableIterator<B>

Example

typescript
const iterator =  filter((v) => v > 2, [1, 3, 4])
iterator.next().value = 3
iterator.next().value = 4
iterator.next().done = true

More examples

Source

packages/core/src/pipe/lazy/filter.ts:181

filter(fn, iterable)

filter<A>(fn, iterable): IterableIterator<A>

Type parameters

A

Parameters

fn

iterable: Iterable<A>

Returns

IterableIterator<A>

Source

packages/core/src/pipe/lazy/filter.ts:182

filter(fn, iterable)

filter<A, B>(fn, iterable): AsyncIterableIterator<B>

Type parameters

A

B

Parameters

fn

iterable: AsyncIterable<A>

Returns

AsyncIterableIterator<B>

Source

packages/core/src/pipe/lazy/filter.ts:184

filter(fn, iterable)

filter<A>(fn, iterable): AsyncIterableIterator<A>

Type parameters

A

Parameters

fn

iterable: AsyncIterable<A>

Returns

AsyncIterableIterator<A>

Source

packages/core/src/pipe/lazy/filter.ts:185

filter(fn)

filter<A, B>(fn): (iterable) => IteratorReturnValue<A, B>

Type parameters

A extends UniversalIterable

B extends unknown

Parameters

fn

Returns

Function

Parameters

iterable: A

Returns

IteratorReturnValue<A, B>

Source

packages/core/src/pipe/lazy/filter.ts:187

filter(fn)

filter<A, B>(fn): (iterable) => IteratorReturnValue<B, A>

Type parameters

A

B extends UniversalIterable<A>

Parameters

fn

Returns

Function

Parameters

iterable: B

Returns

IteratorReturnValue<B, A>

Source

packages/core/src/pipe/lazy/filter.ts:190

Released under the MIT License.