bloody-transform
v1.0.0
Published
creates partial functions that take one argument
Downloads
3
Readme
transform
creates partial functions that take one argument
useful for APIs like promises .then
which let functions you pass in it take one argument only.
e.g.
var transform = require("bloody-transform")
, foo = function(fn, value){
return fn(value)
}
, partialFoo = transform(foo, 1, console)
partialFoo(console.log)("value")
// logs "value"
install
$ npm install bloody-transform
require
var transform = require("bloody-transform")
api
transform(fn[, index=0, [thisValue]]) -> fn
returns a function that will take all the prefilled arguments and will return a function that takes just one argument and fill the index
arguments when executed.