1.0.0 • Published 9 years ago

argument-index v1.0.0

Weekly downloads
119
License
MIT
Repository
github
Last release
9 years ago

argument-index Build Status

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

Required
Type: number

The numeric index of the argument to process.

fn

Required
Type: function
Arguments: value

A single argument function that will be called with the argument at the specified index.

License

MIT © Ben Drucker