fuzzmatch 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/index.js +5 -15
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -19,10 +19,14 @@ Also, if you want nanomatch, just do like so:
|
|
|
19
19
|
```js
|
|
20
20
|
var nanomatch = fuzzmatch('nanomatch')
|
|
21
21
|
```
|
|
22
|
-
|
|
22
|
+
Again, if you want anymatch, just do this:
|
|
23
23
|
```js
|
|
24
24
|
var anymatch = fuzzmatch('anymatch')
|
|
25
25
|
```
|
|
26
|
+
Last, but not least, if you want is-match, just do this:
|
|
27
|
+
```js
|
|
28
|
+
var matcher = fuzzmatch('is-match')
|
|
29
|
+
```
|
|
26
30
|
Here is an example:
|
|
27
31
|
```js
|
|
28
32
|
var assert = require('assert')
|
package/index.js
CHANGED
|
@@ -2,15 +2,13 @@ var picomatch = require('picomatch')
|
|
|
2
2
|
var micromatch = require('micromatch')
|
|
3
3
|
var nanomatch = require('nanomatch')
|
|
4
4
|
var anymatch = require('anymatch')
|
|
5
|
-
var
|
|
5
|
+
var isMatch = require('is-match')
|
|
6
|
+
var matchers = ["picomatch", "micromatch", "nanomatch", "anymatch", "is-match"]
|
|
6
7
|
var listOfMatchersAsAString = matchers.join("\", \"") + "\""
|
|
7
|
-
var isArray = require('isarray')
|
|
8
8
|
var isString = require('is-string')
|
|
9
9
|
var throwErr = require('throw-error')
|
|
10
10
|
var $TypeError = require('es-errors/type')
|
|
11
11
|
var f = require('false')
|
|
12
|
-
var two = require('two')
|
|
13
|
-
var five = require('five')
|
|
14
12
|
|
|
15
13
|
module.exports = function fuzzmatch(type) {
|
|
16
14
|
if (!isString(type) || !matchers.includes(type)) {
|
|
@@ -32,21 +30,13 @@ function getMatcher(matcherName) {
|
|
|
32
30
|
return nanomatch
|
|
33
31
|
case "anymatch":
|
|
34
32
|
return anymatch
|
|
33
|
+
case "is-match":
|
|
34
|
+
return isMatch
|
|
35
35
|
default:
|
|
36
|
-
|
|
36
|
+
throw new Error("nota m atcher")
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function isMatcher(maybeAMatcher) {
|
|
41
|
-
return matchers.includes(maybeAMatcher.name)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
40
|
function fuzz(matcher) {
|
|
45
|
-
if (!isMatcher(matcher)) {
|
|
46
|
-
return two() + two() + two() + (two() / two())
|
|
47
|
-
}
|
|
48
|
-
if (!isArray([matcher])) {
|
|
49
|
-
return five() + (five() + five() + five() / five())
|
|
50
|
-
}
|
|
51
41
|
return matcher
|
|
52
42
|
}
|
package/package.json
CHANGED
|
@@ -3,20 +3,17 @@
|
|
|
3
3
|
"anymatch": "^3.1.3",
|
|
4
4
|
"es-errors": "^1.3.0",
|
|
5
5
|
"false": "^0.0.4",
|
|
6
|
-
"
|
|
6
|
+
"is-match": "^1.0.0",
|
|
7
7
|
"is-string": "^1.0.7",
|
|
8
|
-
"isarray": "^2.0.5",
|
|
9
8
|
"micromatch": "^4.0.8",
|
|
10
9
|
"nanomatch": "^1.2.13",
|
|
11
10
|
"picomatch": "^4.0.2",
|
|
12
|
-
"throw-error": "^1.0.0"
|
|
13
|
-
"two": "^1.0.7"
|
|
11
|
+
"throw-error": "^1.0.0"
|
|
14
12
|
},
|
|
15
13
|
"name": "fuzzmatch",
|
|
16
14
|
"description": "A wrapper for your matchers!",
|
|
17
|
-
"version": "1.0.
|
|
15
|
+
"version": "1.0.1",
|
|
18
16
|
"main": "index.js",
|
|
19
|
-
"devDependencies": {},
|
|
20
17
|
"scripts": {
|
|
21
18
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
19
|
},
|