fp-minimal
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

fp-minimal

Minimal typed functional programming in TypeScript.

  • 1.6KB mini library
  • For people who don't want to install a lot of APIs just for function composition

Installation

yarn add fp-minimal

API

fp-minimal exposes only 2 functions.

pipe

import { pipe } from 'fp-minimal';
 
const double = (x: number) => x * 2;
const addOne = (x: number) => x + 1;
const square = (x: number) => x * x;
 
pipe(double, addOne, square)(2) // 25

curry

import { curry } from 'fp-minimal';
 
const add = (x: number, y: number) => x + y;
const addOne = curry(add)(1);
 
addOne(2); // 3
[1, 2, 3].map(addOne); // [2, 3, 4]

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i fp-minimal

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

10.3 kB

Total Files

14

Last publish

Collaborators

  • okmttdhr