Giter Site home page Giter Site logo

rojiwon123 / fxts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marpple/fxts

0.0 0.0 1.0 4.88 MB

A functional programming library for TypeScript/JavaScript

Home Page: https://fxts.dev

License: Apache License 2.0

Shell 0.09% JavaScript 1.73% TypeScript 97.87% CSS 0.27% Makefile 0.04%

fxts's Introduction

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

fxts's People

Contributors

ppeeou avatar shine1594 avatar jbl428 avatar sunrabbit123 avatar kuhave avatar rojiwon123 avatar hg-pyun avatar khg0712 avatar dongheeleeme avatar sang-w0o avatar darky avatar jaemedev avatar daschtour avatar gabriel-ss avatar phryxia avatar timgates42 avatar degurii avatar dependabot[bot] avatar flex-jonghyen avatar lifeisegg123 avatar odoldotol avatar okinawaa avatar

Forkers

shine1594

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.