to4iki / prefn

JavaScript simple functional extension.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prefn

NPM package Build Status License

Description

JavaScript simple functional extension.

Usage

preparation

let f = x => x + 10
let g = x => x * 2
let plus = (a,b,c) => a + b + c;
compose
let h = f.compose(g);
h(1) // 12
andThen
let h = f.andThen(g);
h(1) // 22
curried
let f = plus.curried();
f(1,2,3) // 6
f(1)(2,3) // 6
f(1)(2)(3) // 6
f(1,2)(3) // 6
partial
let f = plus.partial(1, undefined, 3);
f(1) // 5
f(2) // 6
f(3) // 7

Installation

npm

Install

$ npm i -D prefn

Use

require('prefn');

Author

to4iki

Licence

MIT

About

JavaScript simple functional extension.


Languages

Language:JavaScript 100.0%