1 | # matchdep [![Build Status](https://secure.travis-ci.org/tkellen/node-matchdep.png?branch=master)](http://travis-ci.org/tkellen/node-matchdep)
|
2 |
|
3 | > Use minimatch to filter npm module dependencies by name.
|
4 |
|
5 | ## Examples
|
6 |
|
7 | ```js
|
8 | var matchdep = require('matchdep');
|
9 |
|
10 | // Filter dependencies (with autoloading of package.json from cwd)
|
11 | matchdep.filter('mini*');
|
12 |
|
13 | // Filter devDependencies (with config string indicating file to be required)
|
14 | matchdep.filterDev('grunt-contrib-*', './package.json');
|
15 |
|
16 | // Filter peerDependencies (with config string indicating file to be required)
|
17 | matchdep.filterDev('foo-{bar,baz}', './some-other.json');
|
18 |
|
19 | // Filter all dependencies (with explicit config provided)
|
20 | matchdep.filterAll('*', require('./yet-another.json'));
|
21 | ```
|
22 |
|
23 | ## Usage
|
24 |
|
25 | ```js
|
26 | filter(pattern, config)
|
27 | filterDev(pattern, config)
|
28 | filterPeer(pattern, config)
|
29 | filterAll(pattern, config)
|
30 | ```
|
31 |
|
32 | ### pattern
|
33 | Type: `String`
|
34 | Default: none
|
35 |
|
36 | [minimatch](https://github.com/isaacs/minimatch) compatible pattern to filter dependencies.
|
37 |
|
38 | ### config
|
39 | Type: `String` or `Object`
|
40 | Default: `path.resolve(process.cwd(), 'package.json')`
|
41 |
|
42 | If config is a string, matchdep will attempt to require it. If it is an object, it will be used directly.
|