1.2.0 • Published 9 months ago

@fxts/core v1.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months 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

1.2.0

9 months ago

1.1.0

9 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.29.0

1 year ago

0.28.1

1 year ago

0.28.0

1 year ago

0.27.0

1 year ago

0.26.0

1 year ago

0.25.0

1 year ago

0.24.0

1 year ago

0.21.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.23.0

2 years ago

0.22.0

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.15.1

2 years ago

0.14.0

2 years ago

0.13.0-alpha-1

2 years ago

0.13.0

2 years ago

0.12.1

2 years ago

0.12.1-alpha-1

2 years ago

0.12.1-alpha-2

2 years ago

0.12.1-alpha-3

2 years ago

0.11.0

3 years ago

0.10.1

3 years ago

0.12.0

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.4.2

3 years ago

0.3.0

4 years ago

0.3.2

4 years ago

0.2.3

4 years ago

0.3.1

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago