Pass an argument at a specified index along to a function
Install
$ npm install --save argument-index
Usage
var argument = require('argument-index')
var doubleSecond = argument(1, function double (value) {
return value * 2
})
doubleSecond(1, 2)
//=> 4
doubleSecond(2, 5)
//=> 10
API
argument(index, fn)
-> function
Returns a function (outer) that will call fn
(inner) with the outer argument at index
.index
RequiredType:
number
The numeric index of the argument to process.
fn
RequiredType:
function
Arguments:
value
A single argument function that will be called with the argument at the specified index.