# file-match

> Match filepath is validated, or exclude filepath that don't need.

Latest version **1.0.2** (published 2014-12-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install file-match
pnpm add file-match
yarn add file-match
bun add file-match
```

## 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.2 |
| Published | 2014-12-18 |
| First published | 2014-12-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | douzi |
| Maintainers | douzi |
| Keywords | filepath, match, minimatch, grunt filematch |

## Links

- npm: https://www.npmjs.com/package/file-match
- Repository: https://github.com/douzi8/file-match
- Issues: https://github.com/douzi8/file-match/issues
- npm.io page: https://npm.io/package/file-match

## Dependencies (1)

- [utils-extend](https://npm.io/package/utils-extend.md) ^1.0.6

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2014-12-18
- 1.0.1 — 2014-12-07
- 1.0.0 — 2014-12-07

## README

file-match
==========

Match filepath is validated, or exclude filepath that don't need

```js
var fileMatch = require('file-match');

var filter = fileMatch('*.js');

filter('a.js');            // true
filter('path/a.js');       // false

var filter = fileMatch([
  '**/*',
  '!path/*.js'
  '!img/**/.{jpg,png,gif}'
]);

filter('src/demo.js')           // true
filter('path/demo.js')          // false
filter('path/path/demo.js')     // true
filter('img/demo.png')          // false
filter('img/path/demo.png')     // false

var filter = fileMatch([
  'path/*.js'
], true);

```

If the filter value is empty string or empty arry, it will always return false,
if it's ``null``, will always return true.

#### filter description
* `*.js`  only match js files in current dir.
* `**/*.js` match all js files.
* `path/*.js` match js files in path.
* `!*.js` exclude js files in current dir.
* ``.{jpg,png,gif}`` means jpg, png or gif
```
'**/*'                 // Match all files
'!**/*.js'             // Exclude all js files
'**/*.{jpg,png,gif}'   // Match jpg, png, or gif files
```

### ignore case
* ignore {boolean} [ignore = false]

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