
Company News
Meet the Socket Team at RSAC and BSidesSF 2026
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.
functional.js
Advanced tools
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.
FAQs
A lightweight, TypeScript-first functional programming library with excellent type inference
The npm package functional.js receives a total of 8,160 weekly downloads. As such, functional.js popularity was classified as popular.
We found that functional.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.

Research
/Security News
OpenVSX releases of Aqua Trivy 1.8.12 and 1.8.13 contained injected natural-language prompts that abuse local AI coding agents for system inspection and potential data exfiltration.