requirem

0.7.5 • Public • Published

requirem progressed.io

build NPM version

Tiny, require 'em things with knobs.

Unicorn approval pending.

usage

var requirem = require('requirem');
 
// works with no arguments,
var myProject = requirem(); 
// equivalent to require('./.') from any dir
 
// for directories,
var dirExports = requirem('./folder');
var dirExports = requirem('./folder/subfolder');
 
// and modules
var util = requirem('./lib/utils');
// if ./lib/utils is a module 
// it will be required as so even if it was a directory
 
// exports are camelkeyed
var dirExports = requirem('./routes'); 
// ./routes was a directory but not a module
// {
//       userAdmin : [Function]  file was "user-admin.js"
//   userSomething : [Function]  file was "user.something.js"
// }
 
// filters via regexp
var headerExports = requirem(/header-(.*)\.js/);
var headerExports = requirem('./partial', /header-(.*)\.js/);
// {
//   headerHome : [Function]
//   headerSomething : [Function]
// }
 
// reload option cleans the require.cache
var gaze = new requirem('gaze').Gaze('./lib/*.js');
gaze.on('all', function(ev, filepath){
  ev.delete || requirem(filepath, { reload : true })
});

~ 50 SLOC

install

$ npm install --save requirem

test

$ npm test

license

LICENSE

Package Sidebar

Install

npm i requirem

Weekly Downloads

3

Version

0.7.5

License

MIT

Last publish

Collaborators

  • stringparser