<commit_before># is-match [![NPM version](https://badge.fury.io/js/is-match.svg)](http://badge.fury.io/js/is-match)  [![Build Status](https://travis-ci.org/jonschlinkert/is-match.svg)](https://travis-ci.org/jonschlinkert/is-match)

> Create a matching function from a glob pattern, regex, string, array, object or function.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i is-match --save
```

## Usage

```js
var isMatch = require('is-match');
```

### Create matchers:

**from a string:**

```js
var isMatch = matcher('a')

isMatch('a');
//=> true

isMatch('b');
//=> false
```

**from a glob pattern:**

```js
var isMatch = matcher('*')
isMatch('a'); //=> true

var isMatch = matcher('!b')
isMatch('a'); //=> true

var isMatch = matcher('!b')
isMatch('b'); //=> false
```

**from an array of glob patterns:**

```js
var isMatch = matcher(['b'])
isMatch('a'); //=> false

var isMatch = matcher(['b', 'a'])
isMatch('a'); //=> true

var isMatch = matcher(['b', 'c', '*'])
isMatch('a'); //=> true
```

**from a regex:**

```js
var isMatch = matcher(/a/);

isMatch('a');
//=> true

isMatch('b');
//=> false
```

**from a function:**

```js
var isMatch = matcher(function  (val) {
  return val === 'a';
});
isMatch('a');
//=> true

isMatch('b');
//=> false
```

**from an object:**

```js
var isMatch = matcher({a: 'b'});

isMatch({a: 'b'}); //=> true
isMatch({a: 'b', c: 'd'}); //=> false
isMatch({e: 'f', c: 'd'}); //=> false
```

## Related projects

* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern.
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://github.com/jonschlinkert/micromatch)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-match/issues/new)

## Author

**<NAME>**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 <NAME>
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 01, 2015._<commit_msg>update docs for 0.4.0<commit_after># is-match [![NPM version](https://badge.fury.io/js/is-match.svg)](http://badge.fury.io/js/is-match)  [![Build Status](https://travis-ci.org/jonschlinkert/is-match.svg)](https://travis-ci.org/jonschlinkert/is-match)

> Create a matching function from a glob pattern, regex, string, array, object or function.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i is-match --save
```

## Usage

```js
var isMatch = require('is-match');
```

### Create matchers:

**from a string:**

```js
var isMatch = matcher('a')

isMatch('a');
//=> true

isMatch('b');
//=> false
```

**from a glob pattern:**

```js
var isMatch = matcher('*')
isMatch('a'); //=> true

var isMatch = matcher('!b')
isMatch('a'); //=> true

var isMatch = matcher('!b')
isMatch('b'); //=> false
```

**from an array of glob patterns:**

```js
var isMatch = matcher(['b'])
isMatch('a'); //=> false

var isMatch = matcher(['b', 'a'])
isMatch('a'); //=> true

var isMatch = matcher(['b', 'c', '*'])
isMatch('a'); //=> true
```

**from a regex:**

```js
var isMatch = matcher(/a/);

isMatch('a');
//=> true

isMatch('b');
//=> false
```

**from a function:**

```js
var isMatch = matcher(function  (val) {
  return val === 'a';
});
isMatch('a');
//=> true

isMatch('b');
//=> false
```

**from an object:**

```js
var isMatch = matcher({a: 'b'});

isMatch({a: 'b'}); //=> true
isMatch({a: 'b', c: 'd'}); //=> false
isMatch({e: 'f', c: 'd'}); //=> false
```

## Related projects

* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob)
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern. | [homepage](https://github.com/jonschlinkert/is-glob)
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-match/issues/new).

## Author

**<NAME>**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 <NAME>
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 08, 2015._
{'fraction_non_alphanumeric': 0.2226385328337606, 'fraction_numerical': 0.004535594557286532, 'mean_word_length': 4.3445732349841935, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, 'https://': 24, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6998327', 'n_tokens_mistral': 1922, 'n_tokens_neox': 1824, 'n_words': 457}