1.0.0 • Published 4 years ago

map-invert v1.0.0

Weekly downloads
-
License
Unlicense
Repository
gitlab
Last release
4 years ago

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
1.0.0

4 years ago