Skip to main content
Module

x/froebel/object.ts>map

A strictly typed utility library.
Latest
variable map
import { map } from "https://deno.land/x/froebel@v0.23.2/object.ts";

Map over data. data can be a regular object, a Map, a Set, or an array.

Examples

Example 1

// -> { a: 1, b: 2 }
map({ a: '1', b: '2' }, (key, value) => [key, parseInt(value)])

Example 2

// -> Map([ [2, 1], [4, 3] ])
map(new Map([ [1, 2], [3, 4] ]), (key, value) => [key + 1, value - 1])

type

MapFun