reapply
Require a module and apply the export if it is a function.
npm install reapply --save
npm stats
API Example
require
var reapply =
reapply/2
//=> hello world
reapply/1
modules
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