Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/ahh/src/iterator.ts>Iterator#map

Opinionated idiomatic features for TypeScript.
Latest
method Iterator.prototype.map
import { Iterator } from "https://deno.land/x/ahh@v0.14.0/src/iterator.ts";

Creates an Iterator that calls fn one each item of this.

Examples

Example 1

import { assert } from "../test_deps.ts";
import I from "./iterator.ts";

const toString = (i: number): string => i.toString();
const iter = I.fromIter([1, 2, 3]).map(toString);

assert(iter.next() === "1");
assert(iter.next() === "2");
assert(iter.next() === "3");

Type Parameters

U extends Some<unknown>

Parameters

fn: (item: T) => U