@lucid-softworks/array-group-by
v0.1.0
Published
Group array values into a type-safe Map.
Maintainers
Readme
@lucid-softworks/array-group-by
Group array values into a type-safe Map.
import { groupBy } from "@lucid-softworks/array-group-by";
groupBy(["ant", "ape", "bear"], (value) => value.slice(0, 1));
// Map { "a" => ["ant", "ape"], "b" => ["bear"] }A Map supports object, symbol, and prototype-like string keys without
coercion or prototype-pollution hazards. Key and value insertion order remain
stable, and the input is never mutated.
