0.28.1 • Published 27 days ago

@fxts/core v0.28.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
27 days ago

Build Status npm version

fxts-icon FxTS

FxTS is a functional library for TypeScript/JavaScript programmers.

Why FxTS?

  • Lazy evaluation
  • Handling concurrent requests
  • Type inference
  • Follow iteration protocols Iterable / AsyncIterable

Installation

npm install @fxts/core

Documentation

Please review the API documentation

Usage

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)

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

you can start here

Build

  • npm run build

Running Test

  • npm test

Running Type Test

  • npm run compile:check

License

Apache License 2.0

0.28.1

27 days ago

0.28.0

2 months ago

0.27.0

2 months ago

0.26.0

2 months ago

0.25.0

2 months ago

0.24.0

3 months ago

0.21.0

8 months ago

0.20.0

8 months ago

0.19.0

9 months ago

0.17.0

11 months ago

0.18.0

10 months ago

0.23.0

7 months ago

0.22.0

7 months ago

0.16.0

11 months ago

0.15.0

1 year ago

0.15.1

12 months ago

0.14.0

1 year ago

0.13.0-alpha-1

1 year ago

0.13.0

1 year ago

0.12.1

1 year ago

0.12.1-alpha-1

1 year ago

0.12.1-alpha-2

1 year ago

0.12.1-alpha-3

1 year ago

0.11.0

2 years ago

0.10.1

2 years ago

0.12.0

1 year ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.2.3

2 years ago

0.3.1

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago