Upgrade Ava to v4

This commit is contained in:
Henry Mercer 2022-02-01 18:01:11 +00:00
parent 9a40cc5274
commit ce89f1b611
1153 changed files with 27264 additions and 95308 deletions

117
node_modules/matcher/readme.md generated vendored
View file

@ -1,4 +1,4 @@
# matcher [![Build Status](https://travis-ci.com/sindresorhus/matcher.svg?branch=master)](https://travis-ci.com/sindresorhus/matcher)
# matcher
> Simple [wildcard](https://en.wikipedia.org/wiki/Wildcard_character) matching
@ -6,14 +6,14 @@ Useful when you want to accept loose string input and regexes/globs are too conv
## Install
```
$ npm install matcher
```sh
npm install matcher
```
## Usage
```js
const matcher = require('matcher');
import {matcher, isMatch} from 'matcher';
matcher(['foo', 'bar', 'moo'], ['*oo', '!foo']);
//=> ['moo']
@ -21,38 +21,53 @@ matcher(['foo', 'bar', 'moo'], ['*oo', '!foo']);
matcher(['foo', 'bar', 'moo'], ['!*oo']);
//=> ['bar']
matcher.isMatch('unicorn', 'uni*');
matcher('moo', ['']);
//=> []
matcher('moo', []);
//=> []
matcher([''], ['']);
//=> ['']
isMatch('unicorn', 'uni*');
//=> true
matcher.isMatch('unicorn', '*corn');
isMatch('unicorn', '*corn');
//=> true
matcher.isMatch('unicorn', 'un*rn');
isMatch('unicorn', 'un*rn');
//=> true
matcher.isMatch('rainbow', '!unicorn');
isMatch('rainbow', '!unicorn');
//=> true
matcher.isMatch('foo bar baz', 'foo b* b*');
isMatch('foo bar baz', 'foo b* b*');
//=> true
matcher.isMatch('unicorn', 'uni\\*');
isMatch('unicorn', 'uni\\*');
//=> false
matcher.isMatch('UNICORN', 'UNI*', {caseSensitive: true});
isMatch(['foo', 'bar'], 'f*');
//=> true
matcher.isMatch('UNICORN', 'unicorn', {caseSensitive: true});
isMatch(['foo', 'bar'], ['a*', 'b*']);
//=> true
isMatch('unicorn', ['']);
//=> false
matcher.isMatch(['foo', 'bar'], 'f*');
//=> true
matcher.isMatch(['foo', 'bar'], ['a*', 'b*']);
//=> true
matcher.isMatch('unicorn', ['tri*', 'UNI*'], {caseSensitive: true});
isMatch('unicorn', []);
//=> false
isMatch([], 'bar');
//=> false
isMatch([], []);
//=> false
isMatch('', '');
//=> true
```
## API
@ -61,21 +76,21 @@ It matches even across newlines. For example, `foo*r` will match `foo\nbar`.
### matcher(inputs, patterns, options?)
Accepts an array of `input`'s and `pattern`'s.
Accepts a string or an array of strings for both `inputs` and `patterns`.
Returns an array of `inputs` filtered based on the `patterns`.
### matcher.isMatch(input, pattern, options?)
### isMatch(inputs, patterns, options?)
Accepts either a string or array of strings for both `input` and `pattern`.
Accepts a string or an array of strings for both `inputs` and `patterns`.
Returns a `boolean` of whether any given `input` matches every given `pattern`.
Returns a `boolean` of whether any of given `inputs` matches all the `patterns`.
#### input
#### inputs
Type: `string | string[]`
String or array of strings to match.
The string or array of strings to match.
#### options
@ -90,16 +105,60 @@ Treat uppercase and lowercase characters as being the same.
Ensure you use this correctly. For example, files and directories should be matched case-insensitively, while most often, object keys should be matched case-sensitively.
#### pattern
```js
import {isMatch} from 'matcher';
isMatch('UNICORN', 'UNI*', {caseSensitive: true});
//=> true
isMatch('UNICORN', 'unicorn', {caseSensitive: true});
//=> false
isMatch('unicorn', ['tri*', 'UNI*'], {caseSensitive: true});
//=> false
```
##### allPatterns
Type: `boolean`\
Default: `false`
Require all negated patterns to not match and any normal patterns to match at least once. Otherwise, it will be a no-match condition.
```js
import {matcher} from 'matcher';
// Find text strings containing both "edge" and "tiger" in arbitrary order, but not "stunt".
const demo = (strings) => matcher(strings, ['*edge*', '*tiger*', '!*stunt*'], {allPatterns: true});
demo(['Hey, tiger!', 'tiger has edge over hyenas', 'pushing a tiger over the edge is a stunt']);
//=> ['tiger has edge over hyenas']
```
```js
import {matcher} from 'matcher';
matcher(['foo', 'for', 'bar'], ['f*', 'b*', '!x*'], {allPatterns: true});
//=> ['foo', 'for', 'bar']
matcher(['foo', 'for', 'bar'], ['f*'], {allPatterns: true});
//=> []
```
#### patterns
Type: `string | string[]`
Use `*` to match zero or more characters. A pattern starting with `!` will be negated.
Use `*` to match zero or more characters.
A leading `!` negates the pattern.
An input string will be omitted, if it does not match any non-negated patterns present, or if it matches a negated pattern, or if no pattern is present.
## Benchmark
```
$ npm run bench
```sh
npm run bench
```
## Related