reapply
v0.1.1
Published
Require a module and apply the export if it is a function.
Downloads
14
Maintainers
Readme
reapply
Require a module and apply the export if it is a function.
npm install reapply --save
npm stats
API Example
require
var reapply = require('reapply')
reapply/2
reapply(['%s world', 'hello'], 'format')
//=> hello world
reapply/1
modules.forEach(reapply([app]))
for the above example, consider that a developer may want to bootstrap an application by applying many "middleware" functions to a given
app
object. Each module exports a function that takes anapp
parameter likemodule.exports = function (app) { app.use(…) }
.
Features
- Supports partial application.
- Supports function application with parameters.
API
reapply(parameters, moduleId)
arguments
parameters: (Array)
parameters to pass to applied function.moduleId: (String)
module id to pass torequire
.
returns
(*)
returns result of function application.
Alternatives
- If you find yourself wanting to map over a list with
reapply
you might be interested in reapply-list.
Contributing
SEE: contributing.md