Use micromatch to filter npm module dependencies by name.
npm install @fomantic/matchdepjs
var matchdep = require('matchdep');
// Filter dependencies (by autoloading nearest package.json)
matchdep.filter('mini*');
// Filter devDependencies (with config string indicating file to be required)
matchdep.filterDev('grunt-contrib-*', './package.json');
// Filter peerDependencies (with config string indicating file to be required)
matchdep.filterPeer('foo-{bar,baz}', './some-other.json');
// Filter all dependencies (with explicit config provided)
matchdep.filterAll('*', require('./yet-another.json'));
// Filter all dependencies, exclude grunt (multiple matching patterns)
matchdep.filterAll(['*','!grunt']);
`
Usage
`js
filter(pattern, config)
filterDev(pattern, config)
filterPeer(pattern, config)
filterAll(pattern, config)
`
$3
Type: String|Array
Default: 'none'
A [micromatch] compatible match pattern to filter dependencies.
$3
Type: String or Object`