Skip to content

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

Function: take()

take(length, iterable)

take<A>(length, iterable): IterableIterator<A>

Returns IterableIterator/AsyncIterableIterator that take length values from iterable

Type parameters

A

Parameters

length: number

iterable: Iterable<A>

Returns

IterableIterator<A>

Example

typescript
for (const v of take(2, [1, 2, 3, 4])) {
  console.log(v)
}
// 1, 2

More examples

Source

packages/core/src/pipe/lazy/take.ts:44

take(length, iterable)

take<A>(length, iterable): AsyncIterableIterator<Awaited<A>>

Type parameters

A

Parameters

length: number

iterable: AsyncIterable<A>

Returns

AsyncIterableIterator<Awaited<A>>

Source

packages/core/src/pipe/lazy/take.ts:46

take(length)

take<A>(length): (iterable) => IteratorReturnValue<A>

Type parameters

A extends UniversalIterable

Parameters

length: number

Returns

Function

Parameters

iterable: A

Returns

IteratorReturnValue<A>

Source

packages/core/src/pipe/lazy/take.ts:48

Released under the MIT License.