0.1.1 • Published 11 years ago
reapply v0.1.1
reapply
Require a module and apply the export if it is a function.
npm install reapply --savenpm stats
API Example
require
var reapply = require('reapply')reapply/2
reapply(['%s world', 'hello'], 'format')
//=> hello worldreapply/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
appobject. Each module exports a function that takes anappparameter 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
reapplyyou might be interested in reapply-list.
Contributing
SEE: contributing.md