Skip to main content
Module

x/core_fn/uncurry/mod.ts>map

A collection of built-in object method and property as currying function
Latest
variable map
import { map } from "https://deno.land/x/core_fn@v1.0.0-beta.16/uncurry/mod.ts";

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Examples

Example 1

map(() => 1, [1, 2, 3]) // [1, 1, 1]
map((a) => a + 1, new Unit8Array([2, 4, 6])) // Uint8Array(2) [3, 5, 7]

type

<T extends TypedArray | readonly unknown[]>(callbackfn: (
value: T[number],
index: number,
array: T,
) => T[number]
, val: T
) => T extends unknown[] ? Exclude<T, TypedArray> : Exclude<T, unknown[]>