unary
Creates a unary function wrapper which extracts a specific argument by index and applies the argument to the original unary function.
npm install unary --save
npm stats
Examples
require
var unary =
full application
var odds = var fruit = 'apple' 'pear' 'pineapple' 'strawberry' 'orange' 'grapefruit' fruit//=> [ 'apple', 'pineapple', 'orange' ]
functor (+ partial application)
var evens = var fruit = 'apple' 'pear' 'pineapple' 'strawberry' 'orange' 'grapefruit' fruit//=> [ '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.