# @fxts/core

> A functional library for TypeScript/JavaScript programmers.

Latest version **2.0.1** (published 2026-08-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @fxts/core
pnpm add @fxts/core
yarn add @fxts/core
bun add @fxts/core
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2026-08-08 |
| First published | 2021-11-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 3.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1168 |
| Maintainers | marpple-dev-admin, dohyeong, xodltus |
| Keywords | fp, lazy, concurrency |

## Links

- npm: https://www.npmjs.com/package/@fxts/core
- Repository: https://github.com/marpple/FxTS
- Homepage: https://fxts.dev
- Issues: https://github.com/marpple/FxTS/issues
- npm.io page: https://npm.io/package/@fxts/core

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.6.0

## Recent versions

- 2.0.1 (latest) — 2026-08-08
- 2.0.0 — 2026-08-08
- 1.28.0 — 2026-08-08
- 1.26.0 — 2026-02-19
- 1.25.0 — 2026-02-01
- 1.24.0 — 2026-01-21
- 1.23.0 — 2025-12-29
- 1.22.0 — 2025-12-24
- 1.21.1 — 2025-11-26
- 1.21.0 — 2025-11-23
- 1.20.0 — 2025-11-15
- 1.19.0 — 2025-10-17
- 1.18.0 — 2025-10-13
- 1.17.0 — 2025-09-14
- 1.16.0 — 2025-09-09
- … 67 more at https://npm.io/package/@fxts/core/versions

## README

<img src="./website/docs/public/img/fxts.png" alt="FxTS Logo" width="120" />

# FxTS

[![Build Status](https://github.com/marpple/FxTS/actions/workflows/ci.yml/badge.svg)](https://github.com/marpple/FxTS/actions)
[![npm version](https://badge.fury.io/js/@fxts%2Fcore.svg)](https://www.npmjs.com/package/@fxts/core)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)

FxTS is a functional programming library for TypeScript.

- Provides [lazy evaluation](https://fxts.dev/guide/lazy-evaluation) for memory-efficient data processing with functions like [pipe](https://fxts.dev/api/pipe), [map](https://fxts.dev/api/map), [filter](https://fxts.dev/api/filter), and [take](https://fxts.dev/api/take).
- Handles [concurrent requests](https://fxts.dev/guide/handle-concurrency) efficiently with [concurrent](https://fxts.dev/guide/concurrent) and [toAsync](https://fxts.dev/api/toAsync).
- Offers excellent TypeScript support with strong type inference.
- Follows standard [iteration protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) (Iterable/AsyncIterable).

## Why FxTS?

|                                               | FxTS                                                       | lodash            | Native (Array + [Iterator Helpers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator)) |
| --------------------------------------------- | ---------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Lazy evaluation                               | ✅                                                         | 🔶 `_.chain` only | ✅ ES2025                                                                                                                      |
| AsyncIterable pipelines                       | ✅                                                         | ❌                | ❌ (proposal stage)                                                                                                            |
| Concurrency control with backpressure         | ✅ [`concurrentPool`](https://fxts.dev/api/concurrentPool) | ❌                | ❌                                                                                                                             |
| Curried, data-last composition (`pipe`)       | ✅                                                         | 🔶 `lodash/fp`    | ❌                                                                                                                             |
| Early termination across async work (`take`)  | ✅                                                         | ❌                | 🔶 sync only                                                                                                                   |
| Literal-preserving inference (`Record<"a"…>`) | ✅                                                         | ❌                | —                                                                                                                              |
| Deep utils (`isEqual`, `cloneDeep`, `merge`)  | ✅                                                         | ✅                | ❌                                                                                                                             |

Migrating from `p-limit`/`p-map`? See the [migration guide](https://fxts.dev/guide/migrate-from-p-map).

## Installation

```
npm install @fxts/core
```

## Usage

Use `pipe` for function composition or `fx` for method chaining:

```ts
import { each, filter, fx, map, pipe, range, take } from "@fxts/core";

pipe(
  range(10),
  map((a) => a + 10),
  filter((a) => a % 2 === 0),
  take(2),
  each((a) => console.log(a)),
);

// chaining
fx(range(10))
  .map((a) => a + 10)
  .filter((a) => a % 2 === 0)
  .take(2)
  .each((a) => console.log(a));
```

## Usage (concurrent)

Handle multiple async operations in parallel with `concurrent`:

```ts
import { concurrent, countBy, flat, fx, map, pipe, toAsync } from "@fxts/core";

// maybe 1 seconds api
const fetchWiki = (page: string) =>
  fetch(`https://en.wikipedia.org/w/api.php?action=parse&page=${page}`);

const countWords = async (concurrency: number) =>
  pipe(
    ["html", "css", "javascript", "typescript"],
    toAsync,
    map(fetchWiki),
    map((res) => res.text()),
    map((words) => words.split(" ")),
    flat,
    concurrent(concurrency),
    countBy((word) => word),
  );

await countWords(); // 4 seconds
await countWords(2); // 2 seconds
```

## Documentation

For more information, visit [fxts.dev](https://fxts.dev).

For LLM-friendly documentation, see [llms.txt](https://fxts.dev/llms.txt).

## Contributing

We welcome contributions from everyone in the community. Please read our [Contributing Guide](./CONTRIBUTING.md).

## License

Apache License 2.0 © [Marpple](https://www.marpple.com). See [LICENSE](./LICENSE) for details.

---
_Source: https://npm.io/package/@fxts/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
