Type-safe, LINQ-inspired iterable utilities for TypeScript and JavaScript, built for fluent composition and modern functional pipelines.
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
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.
pipe, pipeInto, and compose while preserving discriminated unions and narrowed typesHeads 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.