Webpack
Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
A lightweight, TypeScript-first functional programming library with excellent type inference
A lightweight, TypeScript-first functional programming library
npm install functional.js # or pnpm add functional.js # or yarn add functional.js
import { pipe, map, filter, reduce } from "functional.js"; const data = [1, 2, 3, 4, 5, 6]; const result = pipe( data, filter((x) => x % 2 === 0), map((x) => x * 2), reduce((acc, x) => acc + x) ); console.log(result);
import { curry } from "functional.js"; const add = curry((a: number, b: number) => a + b); add(1, 2); add(1)(2); const add5 = add(5); add5(10);
import { flow, map, filter, pluck } from "functional.js"; interface User { name: string; age: number; active: boolean; } const getActiveUserNames = flow( filter<User>((u) => u.active), map((u) => u.name.toUpperCase()) ); const users: User[] = [ { name: "Alice", age: 30, active: true }, { name: "Bob", age: 25, active: false }, { name: "Charlie", age: 35, active: true } ]; console.log(getActiveUserNames(users));
curry(fn) — Auto-curry any functioncompose(...fns) — Right-to-left function compositionpipe(value, ...fns) — Left-to-right data pipelineflow(...fns) — Left-to-right function compositionmap(fn, array) — Transform array elementsfilter(fn, array) — Filter array by predicatereduce(fn, array) — Reduce array (no initial value)fold(fn, initial, array) — Fold array with initial valueflatMap(fn, array) — Map and flatteneach(fn, array) — Iterate over arraypartition(fn, array) — Split array by predicategroup(fn, array) — Group array by key functionzip(arr1, arr2) — Zip two arrays togetherzipWith(fn, arr1, arr2) — Zip with a combining functionuniq(array) — Remove duplicatesuniqBy(fn, array) — Remove duplicates by key functionfirst(fn, array) — Find first matching elementlast(fn, array) — Find last matching elementevery(fn, array) — Check if all elements matchany(fn, array) — Check if any element matchesbest(comparator, array) — Find best element by comparatorprop(key) — Create property accessorpluck(key, array) — Extract property from array of objectspick(keys, obj) — Select properties from objectomit(keys, obj) — Remove properties from objectpath(pathArray, obj) — Get nested property valueassoc(key, value, obj) — Set property immutablydissoc(key, obj) — Remove property immutablyassign(obj1, obj2) — Merge objectsidentity(x) — Return input unchangedconstant(x) — Create constant functiontap(fn) — Execute side effect and return inputisFunction, isObject, isArrayisString, isNumber, isDate, isRegExpexists, truthy, falsyAll functions have full TypeScript support with proper type inference:
import { pipe, map, filter } from "functional.js"; const numbers = [1, 2, 3, 4, 5]; const result = pipe( numbers, filter((x) => x > 2), map((x) => x.toString()) );
| Library | Bundle Size | TypeScript | Auto-Curry | Notes |
|---|---|---|---|---|
| functional.js | ~3KB | Strong | Yes | Data-last, zero dependencies |
| Ramda | ~50KB | Limited | Yes | Data-last, large API |
| lodash/fp | ~24KB | Good | Yes | Data-last wrappers over lodash |
| underscore | ~17KB | Limited | No | Data-first utilities |
| fp-ts | ~15KB | Strong | No | Types-first, higher learning curve |
Benchmarks run on Node.js 24.13.0 (macOS), using small/medium/large scenarios with isolated processes, warmups, and median results.
Highlights from the latest run:
Use these prompts with AI assistants (ChatGPT, Claude, Cursor, etc.) to get accurate functional.js help:
MIT License © Lee Crossley
Inspired by Ramda, lodash/fp, and fp-ts. Built for modern TypeScript development.
Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
Prettier is an opinionated code formatter
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
Matt Pocock's agent skills for real engineering
Neue Version verfügbar.