1.0.2 • Published 10 months ago

@esfx/iter-grouping v1.0.2

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
10 months ago

@esfx/iter-grouping

An API for describing grouped iterables.

Overview

Installation

npm i @esfx/iter-grouping

Usage

import { groupBy } from "@esfx/iter-fn";
import { Grouping } from "@esfx/iter-grouping";

const people = [{ familyName: "Smith", givenName: "Alice" }, { familyName: "Smith", givenName: "Bob" }];
for (const group of groupBy(people, person => person.familyName)) {
    group.key; // "Smith"
    group.values; // Iterable of "Alice", "Bob"
    group instanceof Grouping; // true
}

API

You can read more about the API here.