0.0.1 • Published 11 years ago

fundot-hold v0.0.1

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

Fundot Hold

Creates functions that only execute if the set number of arguments are given for the functional library Fundot

build status

Example

var hold = require('fundot-hold')

var giveMeThree = hold(3, function (one, two, three) {
  console.log({one: one, two: two, three: three})
})

giveMeThree(1)
giveMeThree(2, 2)
giveMeThree(3, 3, 3)

var giveMeOne = giveMeThree(4, 4)

giveMeOne()
giveMeOne(5)
$ node example/hold.js
{ one: 3, two: 3, three: 3 }
{ one: 4, two: 4, three: 5 }

Methods

var hold = require('fundot-hold')

hold(number, function)

Returns a function that will not call the passed function until the number of arguments given matches the original number required.

Install

With npm do:

npm install fundot-hold

License

MIT