require-props
v0.2.0
Published
Require a set of modules, and add them as properties to target.
Downloads
5
Readme
require-props
Require a set of modules, and add them as properties to target.
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