flip-curried
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    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.

    Install

    npm i flip-curried

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.97 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar