An open API service indexing awesome lists of open source software.

https://github.com/stringparser/requirem

Tiny require'em things with knobs
https://github.com/stringparser/requirem

Last synced: 11 months ago
JSON representation

Tiny require'em things with knobs

Awesome Lists containing this project

README

          

# requirem [progressed.io](https://github.com/fehmicansaglam/progressed.io)

[build](https://travis-ci.org/stringparser/requirem/builds)
[NPM version](http://www.npmjs.org/package/requirem)



Tiny, require 'em things with knobs.








Unicorn approval pending.

### usage

```js
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](http://opensource.org/licenses/MIT)