Skip to main content

Getting Started


FxTS is a library for functional programming using iterable/asyncIterable. It provides users to write more declarative code, as well as to handle asynchronous data and functions.

To build the above, we have many features such as:

  • Lazy evaluation
    • It is a useful way to represent large or possibly infinite enumerable data.
  • Handling concurrent requests
    • It can handle multiple asynchronous requests and also control the count of requests.
  • Type inference
    • Function composition can be inferred.
  • Follow iteration protocols Iterable / AsyncIterable
    • FxTS follows the protocol of the language standard. This means that it matches well with existing functions and functions that will be added in the future.



npm install @fxts/core


yarn add @fxts/core



import { filter, map, pipe, range, reduce, take } from "@fxts/core";

const sum = pipe(
filter((a) => a % 5 === 0),
map((a) => a * 10),
reduce((a, b) => a + b),
); // typeof 'sum' inferred as the number

Note: It is recommended to enable strictFunctionTypes tsc option. If not, type inference does not work as we expected. For example, in the example above, sum is not inferred as a number type if the option is turned off.


Usage is the same as TypeScript, but there are several points to note.


As shown in the example code below, the module imported by default was built targeting es2018 and does not include polyfill.

import { filter, map, pipe, range, reduce, take } from "@fxts/core";

If JavaScript runtime you use does not support es2018, use esm5 submodule instead as shown below.

import { filter, map, pipe, range, reduce, take } from "@fxts/core/esm5";


const { filter, map, pipe, range, reduce } = require("@fxts/core");

// It can be loaded as an individual function
const take = require("@fxts/core/Lazy/take").default;

Note: esm5 and cjs submodules were built targeting es5, and also does not include polyfill.


This script was built targeting es5 and contains polyfill.

<script src=""></script>