# matchdep

> Use micromatch to filter npm module dependencies by name.

Latest version **2.0.0** (published 2017-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install matchdep
pnpm add matchdep
yarn add matchdep
bun add matchdep
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-08-18 |
| First published | 2012-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/matchdep) |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 99 |
| Author | Tyler Kellen |
| Maintainers | phated, tkellen |
| Keywords | package.json, dependencies, devDependencies, peerDependencies |

## Links

- npm: https://www.npmjs.com/package/matchdep
- Repository: https://github.com/tkellen/js-matchdep
- Issues: https://github.com/tkellen/js-matchdep/issues
- npm.io page: https://npm.io/package/matchdep

## Dependencies (4)

- [resolve](https://npm.io/package/resolve.md) ^1.4.0
- [micromatch](https://npm.io/package/micromatch.md) ^3.0.4
- [findup-sync](https://npm.io/package/findup-sync.md) ^2.0.0
- [stack-trace](https://npm.io/package/stack-trace.md) 0.0.10

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2017-08-18
- 1.0.1 — 2016-02-09
- 1.0.0 — 2015-09-27
- 0.3.0 — 2013-10-09
- 0.2.0 — 2013-10-09
- 0.1.2 — 2013-04-07
- 0.1.1 — 2012-11-27
- 0.1.0 — 2012-11-27

## README

# matchdep [![Build Status](https://secure.travis-ci.org/tkellen/js-matchdep.svg?branch=master)](http://travis-ci.org/tkellen/js-matchdep)
> Use [micromatch] to filter npm module dependencies by name.

[![NPM](https://nodei.co/npm/matchdep.png)](https://nodei.co/npm/matchdep/)

## Examples

```js
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)
```

### pattern
Type: `String|Array`
Default: 'none'

A [micromatch] compatible match pattern to filter dependencies.

### config
Type: `String` or `Object`
Default: Path to nearest package.json.

If config is a string, matchdep will attempt to require it.  If it is an object, it will be used directly.

## Release History

* 2017-08-18 - v2.0.0 - Upgrade major versions of dependencies, Upgrade devDeps
* 2016-02-09 - v1.0.1 - switch to [micromatch], remove [globule]
* 2015-09-27 - v1.0.0 - throw when no package.json found, update dependencies, remove node 0.8 support
* 2013-10-09 - v0.3.0 - support multiple pattern matches using [globule]
* 2013-10-08 - v0.2.0 - refactor and support filtering peerDependencies
* 2012-11-27 - v0.1.0 - initial release


[globule]: https://github.com/cowboy/node-globule
[micromatch]: https://github.com/jonschlinkert/micromatch

---
_Source: https://npm.io/package/matchdep · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
