fabricator

Discover collections of constructible instances from strings (filepaths), arrays or objects

Fabricator

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.

npm install fabricator --save
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);

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

npm test