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

x/froebel/object.ts>map

A strictly typed utility library.
Go to Latest
variable map
import { map } from "https://deno.land/x/froebel@v0.21.3/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