Skip to main content
Module

x/bettermap/mod.ts>BetterMap.from

An extension of the Map class with more Array-like features.
Latest
method BetterMap.from
import { BetterMap } from "https://deno.land/x/bettermap@v1.3.0/mod.ts";

Create a new map from an existing Map or an array of key-value pairs.

import Pokemon from "https://deno.land/x/fortuna@v1.1.2/testdata/pokemon.json" assert {
  type: "json",
};

interface PokemonData {
  name: string;
  id: number;
  tier: string;
}

const b = BetterMap.from(Pokemon.map(x => [x.name, x]))
console.log(b)

Parameters

data: Map<K1, V1> | [K1, V1][]

Existing Map / Array of Key-Value pairs.