Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

take

import { take } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/async_iterable.ts";

Take the first n values from an AsyncIterable.

@example
import { take } from "./async_iterable.ts";
import { fromIterable } from "./async_iterable.ts";
import { pipe } from "./fn.ts";

const numbers = fromIterable([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
const firstThree = pipe(
  numbers,
  take(3)
);

for await (const value of firstThree) {
  console.log(value); // 1, 2, 3
}
function take(n: number): <A>(ta: AsyncIterable<A>) => AsyncIterable<A>;
§
take(n: number): <A>(ta: AsyncIterable<A>) => AsyncIterable<A>
[src]

§Parameters

§
n: number
[src]

§Return Type

§
<A>(ta: AsyncIterable<A>) => AsyncIterable<A>
[src]