fuzzmatch 1.0.0 → 1.0.12
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 +2 -2
- package/index.js +33 -42
- package/package.json +26 -20
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ 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
|
```
|
|
@@ -37,4 +37,4 @@ assert(fuzzmatch('nanomatch') === require('nanomatch'))
|
|
|
37
37
|
If you use a lot of matchers in JavaScript, instead of doing `npm i picomatch micromatch nanomatch anymatch`, you can just type `npm i fuzzmatch` and then call it with your matcher name to get the matcher.
|
|
38
38
|
|
|
39
39
|
## contributing
|
|
40
|
-
there is no contributing which is why there is no github repositroy.
|
|
40
|
+
~~there is no contributing which is why there is no github repositroy~~. edit: actually there is a github repository now, so i guess there is contributing. whatever. contribute if you want, i guess
|
package/index.js
CHANGED
|
@@ -1,52 +1,43 @@
|
|
|
1
|
-
var picomatch = require(
|
|
2
|
-
var micromatch = require(
|
|
3
|
-
var nanomatch = require(
|
|
4
|
-
var anymatch = require(
|
|
1
|
+
var picomatch = require("picomatch")
|
|
2
|
+
var micromatch = require("micromatch")
|
|
3
|
+
var nanomatch = require("nanomatch")
|
|
4
|
+
var anymatch = require("anymatch")
|
|
5
5
|
var matchers = ["picomatch", "micromatch", "nanomatch", "anymatch"]
|
|
6
|
-
var listOfMatchersAsAString = matchers.join("
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var f = require('false')
|
|
12
|
-
var two = require('two')
|
|
13
|
-
var five = require('five')
|
|
6
|
+
var listOfMatchersAsAString = matchers.join('", "') + '"'
|
|
7
|
+
var isString = require("is-string")
|
|
8
|
+
var throwErr = require("basic-functions").throw
|
|
9
|
+
var $TypeError = require("es-error-intrinsics/TypeError")
|
|
10
|
+
var f = require("false-value")
|
|
14
11
|
|
|
15
12
|
module.exports = function fuzzmatch(type) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
if (!isString(type) || !matchers.includes(type)) {
|
|
14
|
+
throwErr(
|
|
15
|
+
new $TypeError(
|
|
16
|
+
`Type must be a matcher string, which can be one of the following: ${listOfMatchersAsAString}`,
|
|
17
|
+
),
|
|
18
|
+
)
|
|
19
|
+
return f()
|
|
20
|
+
}
|
|
21
|
+
var matcher = getMatcher(type)
|
|
22
|
+
var resultMatcher = fuzz(matcher)
|
|
23
|
+
return resultMatcher
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
function getMatcher(matcherName) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function isMatcher(maybeAMatcher) {
|
|
41
|
-
return matchers.includes(maybeAMatcher.name)
|
|
27
|
+
switch (matcherName) {
|
|
28
|
+
case "picomatch":
|
|
29
|
+
return picomatch
|
|
30
|
+
case "micromatch":
|
|
31
|
+
return micromatch
|
|
32
|
+
case "nanomatch":
|
|
33
|
+
return nanomatch
|
|
34
|
+
case "anymatch":
|
|
35
|
+
return anymatch
|
|
36
|
+
default:
|
|
37
|
+
return
|
|
38
|
+
}
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
function fuzz(matcher) {
|
|
45
|
-
|
|
46
|
-
return two() + two() + two() + (two() / two())
|
|
47
|
-
}
|
|
48
|
-
if (!isArray([matcher])) {
|
|
49
|
-
return five() + (five() + five() + five() / five())
|
|
50
|
-
}
|
|
51
|
-
return matcher
|
|
42
|
+
return matcher
|
|
52
43
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
"dependencies": {
|
|
3
|
-
"anymatch": "^3.1.3",
|
|
4
|
-
"es-errors": "^1.3.0",
|
|
5
|
-
"false": "^0.0.4",
|
|
6
|
-
"five": "^0.8.0",
|
|
7
|
-
"is-string": "^1.0.7",
|
|
8
|
-
"isarray": "^2.0.5",
|
|
9
|
-
"micromatch": "^4.0.8",
|
|
10
|
-
"nanomatch": "^1.2.13",
|
|
11
|
-
"picomatch": "^4.0.2",
|
|
12
|
-
"throw-error": "^1.0.0",
|
|
13
|
-
"two": "^1.0.7"
|
|
14
|
-
},
|
|
15
2
|
"name": "fuzzmatch",
|
|
3
|
+
"version": "1.0.12",
|
|
16
4
|
"description": "A wrapper for your matchers!",
|
|
17
|
-
"version": "1.0.0",
|
|
18
|
-
"main": "index.js",
|
|
19
|
-
"devDependencies": {},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
-
},
|
|
23
5
|
"keywords": [
|
|
24
6
|
"match",
|
|
25
7
|
"glob",
|
|
26
8
|
"match",
|
|
27
9
|
"picomatch"
|
|
28
10
|
],
|
|
11
|
+
"homepage": "https://github.com/10xly/fuzzmatch#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/10xly/fuzzmatch/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/10xly/fuzzmatch.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
29
20
|
"author": "tj-commits",
|
|
30
|
-
"
|
|
21
|
+
"type": "commonjs",
|
|
22
|
+
"main": "index.js",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"anymatch": "^3.1.3",
|
|
28
|
+
"basic-functions": "^1.0.6",
|
|
29
|
+
"es-error-intrinsics": "^1.0.1",
|
|
30
|
+
"false-value": "^2.0.6",
|
|
31
|
+
"is-string": "^1.0.7",
|
|
32
|
+
"micromatch": "^4.0.8",
|
|
33
|
+
"nanomatch": "^1.2.13",
|
|
34
|
+
"picomatch": "^4.0.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {}
|
|
31
37
|
}
|