map-invert
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

map-invert

Invert Maps. Keys become values and values become keys. Returns a new Map.

import mapInvert from "map-invert";

const myMap = new Map([
  [1, "foo"],
  [2, "bar"],
  [3, "baz"],
]);

const inverted = mapInvert(myMap);

inverted.get("baz");
// => 3

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i map-invert

    Weekly Downloads

    0

    Version

    1.0.0

    License

    Unlicense

    Unpacked Size

    3.71 kB

    Total Files

    6

    Last publish

    Collaborators

    • evanhahn