fabricator

0.5.2 • Public • Published

Fabricator

Version npmBuild StatusDependenciesCoverage Status

Discover collections of constructible instances from strings (filepaths), arrays or objects. Fabricator is a small helper module which does nothing else but detecting constructible JS entities. Strings are resolved as filepaths.

The BigPipe project is using the fabricator to find Pages and/or Pagelets. This gives developers using BigPipe more flexibility. For example, you don't have to worry about adding each Page constructor to BigPipe, simply provide the directory they reside in.

Installation

npm install fabricator --save

Usage

var fabricator = require('fabricator')
  , path = './path/to/directory/with/constructibles';
  , obj = {
      status: require('./npm-status-pagelet'),
      extended: __dirname + '/i/can/be/a/path/to/a/constructor.js'
    }
 
//
// Discover constructors.
//
var stack = fabricator(obj);

Tests

Make sure devDependencies are installed, after run the tests via:

npm test

Package Sidebar

Install

npm i fabricator

Weekly Downloads

22

Version

0.5.2

License

MIT

Last publish

Collaborators

  • v1
  • 3rdeden
  • swaagie