Namespace, Primitive, Method
    Wondering what’s next for npm?Check out our public roadmap! »

    @typed/curry
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    @typed/curry

    A typescript version of curry for functional programming

    Let me have it

    npm install --save @typed/curry
    # or 
    yarn add @typed/curry

    One caveat is that it only accepts functions of arity 5 or less, as I believe functions with more than 3, and especially 5, parameters to be an anti-pattern.

    Basic usage

    import { curry } from '@typed/curry';
     
    const add = curry((a: number, b: number) => a + b);
     
    const add1 = add(1);
    const add2 = add(2);
     
    console.log(add1(5)) // 6
    console.log(add2(5)) // 7

    Install

    npm i @typed/curry

    DownloadsWeekly Downloads

    878

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar