Miss any of our Open RFC calls?Watch the recordings here! »

func-toolkit

1.1.2-1 • Public • Published

Build Status Coverage Status

NPM

func-toolkit

The func-toolkit includes several useful function combinator and utilities. The compinator provided by the func-toolkit can use any iterable object. func-toolkit provides all of these without any dependencies.

How to use

Most examples can find on test code.

Example: all

import { all } from "func-toolkit";
 
const data = [2, 10, 4, 6];
const isAllEven = all(data, element => element % 2 == 0);

Example: andThen

import { andThen } from "func-toolkit";
 
function f(x) {
  return 2 * x;
}
 
function g(x) {
  return x + 2;
}
 
const fg = andThen(f, g);
fg(3); // 8

Example: compose

import { compose } from "func-toolkit";
 
function f(x) {
  return 2 * x;
}
 
function g(x) {
  return x + 2;
}
 
const gf = compose(
  f,
  g
);
gf(4); // 12

Install

npm i func-toolkit

DownloadsWeekly Downloads

0

Version

1.1.2-1

License

MIT

Unpacked Size

28.2 kB

Total Files

46

Last publish

Collaborators

  • avatar