name-parameters
v0.0.2
Published
make a function accept an options object
Downloads
3
Maintainers
Readme
name-parameters
Wrap a function that expects any number of parameters in a new function that expects an options object instead.
usage
const nameParameters = require(`name-parameters`)
const tell = (who, what) => console.log(`${who}: ${what}`)
const notify = nameParameters(tell)
// alternative: nameParameters(tell, [ `who`, `what` ])
notify({ who: `Crew`, what: `Engage` })
// Crew: Engage
api
nameParameters(fn[, parameterNames])
fn
function to wrap.parameterNames
manually name parameters, in order.
Returns a function.