1.0.1 • Published 5 years ago

flip-curried v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

flip-curried

Flip the arguments of a curried function (like Haskell's flip).

NPM Version Downloads Stats

Installation

npm install --save flip-curried

Usage

flip(f)(b)(a) is equivalent to f(a)(b).

import { flip } from "flip-curried";

const n = 3;
const xs = [1, 2, 3, 4, 5];

take(n)(xs);       // [1, 2, 3]
flip(take)(xs)(n); // [1, 2, 3]

function take<A>(n: number): (xs: Array<A>) => Array<A> {
    return xs => xs.slice(0, n);
}

TypeScript

Declarations are included.

1.0.1

5 years ago

1.0.0

5 years ago