Have ideas to improve npm?Join in the discussion! »

    unary

    0.0.2 • Public • Published

    unary

    Creates a unary function wrapper which extracts a specific argument by index and applies the argument to the original unary function.

    Build Status Code Climate js-standard-style

    npm install unary --save
    npm stats

    npm NPM downloads Dependency Status

    Examples

    require
    var unary = require('unary')
    full application
    var odds = unary(odd, 1)
    var fruit = [ 'apple', 'pear', 'pineapple', 'strawberry', 'orange', 'grapefruit' ]
     
    fruit.filter(odds)
    //=> [ 'apple', 'pineapple', 'orange' ]
    functor (+ partial application)
    var evens = unary(even)
    var fruit = [ 'apple', 'pear', 'pineapple', 'strawberry', 'orange', 'grapefruit' ]
     
    fruit.filter(evens(1))
    //=> [ 'pear', 'strawberry', 'grapefruit' ]

    API

    unary(fun, idx)

    arguments
    • fun: (Function) Unary function to wrap.
    • idx: (Number) Index of argument to extract.
    returns
    • (Function) Wrapped unary function.

    License

    GitHub license

    Install

    npm i unary

    DownloadsWeekly Downloads

    8

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • avatar