0.4.1 • Published 9 years ago

requireables v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

Build Status

requireables

Retrieves all the modules from within a target directory as an array paths that can each be used in a require(...) call that occurs from a specific calling directory

Installation

$ npm install requireables --save

Usage

var requireables = require('requireables');

var targetDir = '/some/target/modules/dir';
var callingDir = '/some/calling/dir'
var mods = [];
var paths = requireables.in(targetDir).from(callingDir);

paths.forEach(function(path){
    mods.push(require(path));
});

// 'mods'' will now contain an array of instances of all the modules in 'targetDir'

To asynchronously run requireables, you can use asyncly

asyncly.get(requireables.in(targetDir).from, callingDir).then(function(paths) {
    console.log(paths);
);
0.4.1

9 years ago

0.3.1

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago