ts-iterable-functions
    Preparing search index...

    ts-iterable-functions

    ts-iterable-functions

    npm build TypeScript Coverage Bundle Size

    Type-safe, LINQ-inspired iterable utilities for TypeScript and JavaScript, built for fluent composition and modern functional pipelines.

    • Composable by default – every operator ships in source-first and pipe-first forms so you can pivot between array-style calls and unary pipelines without adapters.
    • Zero-dependency core – tiny footprint with native ESM and CJS bundles generated by esbuild for fast installs and rapid builds.
    • End-to-end type safety – aggressive generics keep key selectors, reducers, and joins fully inferred across long pipelines.
    • Drop-in LINQ ergonomics – familiar primitives like map, groupBy, orderBy, and zip behave the way seasoned C# and F# developers expect.
    • Pipe-friendly ecosystem – pairs naturally with ts-functional-pipe and other unary-first composition helpers.

    Install

    npm install ts-iterable-functions ts-functional-pipe ts-equality-comparer ts-comparer-builder
    

    Compose a strongly typed pipeline

    import { pipeInto } from "ts-functional-pipe";
    import { map, orderBy, thenBy, toArray } from "ts-iterable-functions";

    const cars = [
    { manufacturer: "Ford", model: "Escort" },
    { manufacturer: "Ford", model: "Cortina" },
    { manufacturer: "Renault", model: "Clio" },
    { manufacturer: "Vauxhall", model: "Corsa" },
    { manufacturer: "Ford", model: "Fiesta" },
    { manufacturer: "Fiat", model: "500" },
    ];

    const orderedCars = pipeInto(
    cars,
    orderBy((c) => c.manufacturer),
    thenBy((c) => c.model),
    toArray()
    );

    console.log(orderedCars);
    // → deterministically ordered list with full type inference at every hop
    • Data transformation pipelines in backends or frontends
    • Analytics dashboards and reporting utilities
    • Lightweight ETL tasks without pulling in stream frameworks
    • Crafting reusable collection helpers for design systems and SDKs
    • Replacing brittle nested loops with readable, testable pipelines

    Every transformer is available as _operator(source, ...args) and operator(...args)(source).

    import { _map, map, toArray } from "ts-iterable-functions";
    import { pipeInto } from "ts-functional-pipe";

    const numbers = [1, 2, 3];

    const doubledLegacy = _map(numbers, (value) => value * 2);
    const doubledPipeline = pipeInto(numbers, map((value) => value * 2), toArray());

    Switching between forms keeps refactors painless while preserving full generic inference.

    Browse the full API reference in the online docs for detailed signatures and examples.

    • Leverages pipe, pipeInto, and compose while preserving discriminated unions and narrowed types
    • Ships lightweight helpers like indexed, groupAdjacent, and fullOuterJoin that plug directly into unary pipelines

    Heads up: versions 5.x and later are bundled with esbuild and drop IE11 support.

    We welcome issues, feature ideas, and pull requests. Start a conversation in issues or discussions, and check CONTRIBUTING.md before raising a PR.