reapply-list

Require a list of modules and apply the export if it is function.

Usage no npm install needed!

<script type="module">
  import reapplyList from 'https://cdn.skypack.dev/reapply-list';
</script>

README

reapply-list

Require a list of modules and apply the export if it is function.

Build Status Code Climate js-standard-style

npm install reapply-list --save
npm stats

npm NPM downloads Dependency Status

API Example

index.js
var app = {}
var reapply = require('reapply-list')
var configs = ['cors', 'basic-auth', 'router']

reapply(configs, [app], './app/config')
app/config/*.js
module.exports = function (app) {
  // configure `app` here.
}

Features

  • Supports optional arguments.
  • Supports optional base directory.

API

reapplyList(list[, args][, base])

arguments
  • list: (Array) list of module names or relative paths to require.
  • [args]: (Array) arguments to pass to modules.
  • [base]: (String) module base directory.
returns
  • (Array) result of applying functions..

Alternatives

  • Use reapply.js if you need something slightly different or need more control.

Contributing

SEE: contributing.md

Licenses

GitHub license