require-props

0.2.0 • Public • Published

require-props

Require a set of modules, and add them as properties to target.

NPM module NPM downloads

Installation

npm install --save require-props

Usage

  const requireProps = require('require-props')(__dirname);
  const target = {name:'target'};
  requireProps(target, ['./fixtures/module1', './fixtures/module-2']);
  console.dir(target);
  // { name: 'target', module1: 1, 'module-2': 'target' }

Each required modules must export a function receiving the app instance and returning an object that is then added as a property on the app instance, named as the modules itself.

Api

requireProps(target, modules)

  • target: object - object where all properties are created
  • modules: array - list of modules to requires. They could be module names or relative paths.

License

The MIT License (MIT)

Copyright (c) 2015 Andrea Parodi

Readme

Keywords

Package Sidebar

Install

npm i require-props

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • parroit