Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/array.ts>map

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function map
import { map } from "https://deno.land/x/fun@v2.0.0/array.ts";

Applicable the function fai: (A, index) => I to every element in the array ua.

Examples

Example 1

import * as A from "./array.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  A.array("Hello", "World"),
  A.map(s => s.length),
); // [5, 5]

Parameters

fai: (a: A, i: number) => I

Returns

(ua: ReadonlyArray<A>) => ReadonlyArray<I>