Nine Pedestrians Mesmerized

    add-functions

    1.0.6 • Public • Published

    add-functions

    Build Status Coverage Status

    Add two functions together and choose when the original one gets called!

    require('add-functions')(a, (callOriginal) => { callOriginal(); foo()})

    Adds one or more functions together. Functions will take an additional callOriginal argument. This function will call the function before yours in the added functions.

     
    const a = n => n + 1
    const b = (n, callPrevious) => n + callPrevious() + 1
     
    const c = addFunctions(a, b)
     
    c(0)  // -> 2
    const asynchronouslyAdd2 = addFunctions(
        () => getPromise(),
        (previous) => previous().then((p => p + 1)),
        (previous) => previous().then((p => p + 1)),
    )

    Keywords

    none

    Install

    npm i add-functions

    DownloadsWeekly Downloads

    11

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    5.57 kB

    Total Files

    8

    Last publish

    Collaborators

    • fabiosantoscode