1.0.4 • Published 7 years ago

needs v1.0.4

Weekly downloads
57
License
MIT
Repository
github
Last release
7 years ago

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');

Links

License

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

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago