# filter-npm-modules

> filters a list of require paths to only public npm modules

Latest version **1.0.0** (published 2015-04-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install filter-npm-modules
pnpm add filter-npm-modules
yarn add filter-npm-modules
bun add filter-npm-modules
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-04-26 |
| First published | 2015-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | filter, list, of, modules, require, requires, detective, public, valid, module, package, packages, npm |

## Links

- npm: https://www.npmjs.com/package/filter-npm-modules
- Repository: https://github.com/mattdesl/filter-npm-modules
- Issues: https://github.com/mattdesl/filter-npm-modules/issues
- npm.io page: https://npm.io/package/filter-npm-modules

## Dependencies (6)

- [uniq](https://npm.io/package/uniq.md) ^1.0.1
- [async](https://npm.io/package/async.md) ^0.9.0
- [is-npm-module](https://npm.io/package/is-npm-module.md) ^1.0.0
- [require-package-name](https://npm.io/package/require-package-name.md) ^2.0.0
- [relative-require-regex](https://npm.io/package/relative-require-regex.md) ^1.0.0
- [validate-npm-package-name](https://npm.io/package/validate-npm-package-name.md) ^2.0.1

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-04-26

## README

# filter-npm-modules

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

Filters a list of require paths down to a list of public and valid npm module names. The result will be sorted and de-duplicated.

```js
var filter = require('filter-npm-modules')

var list = [
  'object-assign',
  'url',
  'xtend',
  '_invalid-module-name',
  'this-module-does-not-exist',
  'eases/linear.js',
  'eases/quadratic-in-out.js',
  './foo-bar',
  '../relative/module.js'
]

filter(list, function(names) {
  console.log(names)
  // -> ['eases', 'object-assign', 'url', 'xtend']
})
```

If errors were encountered searching the database, the search will continue but that entry will not be included in the resulting list. 

## Usage

[![NPM](https://nodei.co/npm/filter-npm-modules.png)](https://www.npmjs.com/package/filter-npm-modules)

#### `filter(paths, [opt], callback)`

Filters the list of require `paths` with the optional settings and provides the resulting sorted list to `callback` once all async operations are complete (i.e. searching database). 

Options:

- `cache` - an array of module names to assume exist already in the database

For example, you can use [all-the-package-names](https://github.com/zeke/all-the-package-names) to avoid queries for common packages.

```js
var cache = require('all-the-package-names')
filter(paths, { cache: cache }, callback)
```


## License

MIT, see [LICENSE.md](http://github.com/mattdesl/filter-npm-modules/blob/master/LICENSE.md) for details.

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