@webgap/require-utils
Automatically requires modules with a specific pattern from a specific directory.
Last updated 4 years ago by webgap .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @webgap/require-utils -g
SYNC missed versions from official npm registry.

WebGAP Require Utils

Build Status Test Coverage Code Climate Dependency Status

NPM version NPM downloads

README

This is an utility tool to load multiple node.js modules in parallel.

Dependencies

Handles files/ folders search using fs-finder.
Handles async implementation using async.

API

Installation

npm install @webgap/require-utils --save

Usage

If you want to load module files from a specific directory:

var req = require('../index').require;

req({
  "require": [{
    "directories": ['path/to/lib'],
    "pattern": 'auth-*.js'
  }]
}, function afterRequire(err, modules) {
  assert.equal(err, undefined);
  assert.notEqual(err, modules);
  done();
});

If you want to load modules from a specific directory:

req({
  "require": [{
    "directories": ['path/to/modules'],
    "pattern": 'auth-*'
  }]
}, function afterRequire(err, modules) {
  assert.equal(err, undefined);
  assert.notEqual(err, modules);
  done();
});

Check tests folder.

License

Apache License, Version 2.0

Current Tags

  • 0.0.1                                ...           latest (4 years ago)

1 Versions

  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |