argument-index

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i argument-index

Weekly Downloads

31

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker