Socket
Socket
Sign inDemoInstall

@webgap/require-utils

Package Overview
Dependencies
6
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @webgap/require-utils

Automatically requires modules with a specific pattern from a specific directory.


Version published
Maintainers
1
Install size
3.94 MB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 11 Dec 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc