Socket
Socket
Sign inDemoInstall

needs

Package Overview
Dependencies
5
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    needs

Require multiple modules in node.js.


Version published
Weekly downloads
6
decreased by-68.42%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Needs

NPM Version Build Status Coverage Quality Dependencies

Require multiple modules in node.js.

Installation

$ npm install needs --save

Usage

RegExp pattern

var needs = require('needs');

needs(__dirname, 'controllers', {
	includes: /(.+Controller)\.js$/,
	excludes: /^\.(git|svn)$/
});

// controllers now is an object with references to all modules matching the filter
// for example:
// { HomeController: function HomeController() {...}, ...}

Minimatch string pattern

// or using minimatch string
needs(__dirname, 'controllers', {
	includes: '+(*.js|*.json)',
	excludes: '+(*.git|*.svn)'
});

Array includes and excludes

needs(__dirname, 'controllers', {
	includes: ['*.js', '*.json'],
	excludes: ['*.git', '*.svn']
});

Array pattern

needs(__dirname, 'controllers', ['*.js', '*.json']);

Simplest way to include and exclude

needs(__dirname, 'controllers', ['*.js', '*.json', '!*.git', '!*.svn']);

// or default includes ['*.js', '*.json'] and excludes ['!*.git', '!*.svn']
needs(__dirname, 'controllers');

License

Copyright (c) 2014 Tao Yuan Licensed under the MIT license.

Keywords

FAQs

Last updated on 15 Feb 2017

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