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

map

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

Apply a function to each value in an AsyncIterable.

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

const numbers = fromIterable([1, 2, 3, 4, 5]);
const doubled = pipe(
  numbers,
  map(n => n * 2)
);

for await (const value of doubled) {
  console.log(value); // 2, 4, 6, 8, 10
}
function map<A, I>(fai: (a: A) => I | PromiseLike<I>): (ta: AsyncIterable<A>) => AsyncIterable<I>;
§
map<A, I>(fai: (a: A) => I | PromiseLike<I>): (ta: AsyncIterable<A>) => AsyncIterable<I>
[src]

§Type Parameters

§Parameters

§
fai: (a: A) => I | PromiseLike<I>
[src]

§Return Type

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