array-includes-with-glob 4.0.2 → 4.0.6
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/CHANGELOG.md +0 -6
- package/LICENSE +1 -1
- package/dist/array-includes-with-glob.esm.js +22 -24
- package/dist/array-includes-with-glob.umd.js +2 -2
- package/package.json +37 -41
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 4.0.1 (2021-09-13)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
11
|
-
|
|
12
6
|
## 4.0.0 (2021-09-09)
|
|
13
7
|
|
|
14
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name array-includes-with-glob
|
|
3
3
|
* @fileoverview Like _.includes but with wildcards
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/array-includes-with-glob/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import { isMatch } from 'matcher';
|
|
11
11
|
|
|
12
|
-
var version$1 = "4.0.
|
|
12
|
+
var version$1 = "4.0.6";
|
|
13
13
|
|
|
14
14
|
const version = version$1;
|
|
15
15
|
const defaults = {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
arrayVsArrayAllMustBeFound: "any",
|
|
17
|
+
caseSensitive: true,
|
|
18
18
|
};
|
|
19
19
|
function includesWithGlob(originalInput, stringToFind, originalOpts) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
if (!originalInput.length || !stringToFind.length) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const opts = { ...defaults, ...originalOpts };
|
|
24
|
+
const input = typeof originalInput === "string"
|
|
25
|
+
? [originalInput]
|
|
26
|
+
: Array.from(originalInput);
|
|
27
|
+
if (typeof stringToFind === "string") {
|
|
28
|
+
return input.some((val) => isMatch(val, stringToFind, { caseSensitive: opts.caseSensitive }));
|
|
29
|
+
}
|
|
30
|
+
if (opts.arrayVsArrayAllMustBeFound === "any") {
|
|
31
|
+
return stringToFind.some((stringToFindVal) => input.some((val) => isMatch(val, stringToFindVal, {
|
|
32
|
+
caseSensitive: opts.caseSensitive,
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
return stringToFind.every((stringToFindVal) => input.some((val) => isMatch(val, stringToFindVal, {
|
|
36
|
+
caseSensitive: opts.caseSensitive,
|
|
35
37
|
})));
|
|
36
|
-
}
|
|
37
|
-
return stringToFind.every(stringToFindVal => input.some(val => matcher.isMatch(val, stringToFindVal, {
|
|
38
|
-
caseSensitive: opts.caseSensitive
|
|
39
|
-
})));
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
export { defaults, includesWithGlob, version };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name array-includes-with-glob
|
|
3
3
|
* @fileoverview Like _.includes but with wildcards
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/array-includes-with-glob/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arrayIncludesWithGlob={})}(this,(function(e){"use strict";
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arrayIncludesWithGlob={})}(this,(function(e){"use strict";const t=new Map,n=(e,t)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${t}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter((e=>{if("string"!=typeof e){if(void 0===e)return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof e}' in the array`)}return!0}))},r=(e,n)=>{n={caseSensitive:!1,...n};const r=e+JSON.stringify(n);if(t.has(r))return t.get(r);const s="!"===e[0];s&&(e=e.slice(1)),e=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e).replace(/\\\*/g,"[\\s\\S]*");const i=new RegExp(`^${e}$`,n.caseSensitive?"":"i");return i.negated=s,t.set(r,i),i};function s(e,t,s){return((e,t,s,i)=>{if(e=n(e,"inputs"),0===(t=n(t,"patterns")).length)return[];t=t.map((e=>r(e,s)));const{allPatterns:o}=s||{},a=[];for(const n of e){let e;const r=[...t].fill(!1);for(const[s,i]of t.entries())if(i.test(n)&&(r[s]=!0,e=!i.negated,!e))break;if(!(!1===e||void 0===e&&t.some((e=>!e.negated))||o&&r.some(((e,n)=>!e&&!t[n].negated)))&&(a.push(n),i))break}return a})(e,t,s,!0).length>0}const i={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};e.defaults=i,e.includesWithGlob=function(e,t,n){if(!e.length||!t.length)return!1;const r={...i,...n},o="string"==typeof e?[e]:Array.from(e);return"string"==typeof t?o.some((e=>s(e,t,{caseSensitive:r.caseSensitive}))):"any"===r.arrayVsArrayAllMustBeFound?t.some((e=>o.some((t=>s(t,e,{caseSensitive:r.caseSensitive}))))):t.every((e=>o.some((t=>s(t,e,{caseSensitive:r.caseSensitive})))))},e.version="4.0.6",Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "array-includes-with-glob",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Like _.includes but with wildcards",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -38,9 +38,10 @@
|
|
|
38
38
|
"types": "types/index.d.ts",
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "rollup -c",
|
|
41
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
42
|
-
"
|
|
43
|
-
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent
|
|
41
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
42
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
43
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
44
|
+
"clean_types": "../../scripts/cleanTypes.js",
|
|
44
45
|
"dev": "rollup -c --dev",
|
|
45
46
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
46
47
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
@@ -50,20 +51,15 @@
|
|
|
50
51
|
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
51
52
|
"republish": "npm publish || :",
|
|
52
53
|
"tap": "tap",
|
|
53
|
-
"tsc": "tsc",
|
|
54
54
|
"pretest": "npm run build",
|
|
55
|
-
"test": "npm run
|
|
55
|
+
"test": "npm run test:ci && npm run perf",
|
|
56
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
56
57
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"clean_types": "../../scripts/cleanTypes.js"
|
|
58
|
+
"tsc": "tsc",
|
|
59
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
60
60
|
},
|
|
61
61
|
"tap": {
|
|
62
62
|
"check-coverage": false,
|
|
63
|
-
"coverage-report": [
|
|
64
|
-
"json-summary",
|
|
65
|
-
"text"
|
|
66
|
-
],
|
|
67
63
|
"node-arg": [
|
|
68
64
|
"--no-warnings",
|
|
69
65
|
"--experimental-loader",
|
|
@@ -83,48 +79,48 @@
|
|
|
83
79
|
}
|
|
84
80
|
},
|
|
85
81
|
"dependencies": {
|
|
86
|
-
"@babel/runtime": "^7.
|
|
87
|
-
"matcher": "^
|
|
82
|
+
"@babel/runtime": "^7.16.3",
|
|
83
|
+
"matcher": "^5.0.0"
|
|
88
84
|
},
|
|
89
85
|
"devDependencies": {
|
|
90
|
-
"@babel/cli": "^7.
|
|
91
|
-
"@babel/core": "^7.
|
|
92
|
-
"@babel/node": "^7.
|
|
93
|
-
"@babel/plugin-external-helpers": "^7.
|
|
94
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
95
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.
|
|
96
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
97
|
-
"@babel/plugin-proposal-optional-chaining": "^7.
|
|
98
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
99
|
-
"@babel/preset-env": "^7.
|
|
100
|
-
"@babel/preset-typescript": "^7.
|
|
101
|
-
"@babel/register": "^7.
|
|
86
|
+
"@babel/cli": "^7.16.0",
|
|
87
|
+
"@babel/core": "^7.16.0",
|
|
88
|
+
"@babel/node": "^7.16.0",
|
|
89
|
+
"@babel/plugin-external-helpers": "^7.16.0",
|
|
90
|
+
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
91
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
92
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
93
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
94
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
95
|
+
"@babel/preset-env": "^7.16.4",
|
|
96
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
97
|
+
"@babel/register": "^7.16.0",
|
|
102
98
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
103
99
|
"@rollup/plugin-babel": "^5.3.0",
|
|
104
|
-
"@rollup/plugin-commonjs": "^
|
|
100
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
105
101
|
"@rollup/plugin-json": "^4.1.0",
|
|
106
|
-
"@rollup/plugin-node-resolve": "^13.0.
|
|
102
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
107
103
|
"@rollup/plugin-strip": "^2.1.0",
|
|
108
|
-
"@rollup/plugin-typescript": "^8.
|
|
109
|
-
"@types/node": "^16.9
|
|
104
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
105
|
+
"@types/node": "^16.11.9",
|
|
110
106
|
"@types/tap": "^15.0.5",
|
|
111
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
112
|
-
"@typescript-eslint/parser": "^4.
|
|
113
|
-
"core-js": "^3.
|
|
107
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
108
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
109
|
+
"core-js": "^3.19.1",
|
|
114
110
|
"cross-env": "^7.0.3",
|
|
115
|
-
"eslint": "^
|
|
116
|
-
"lect": "^0.18.
|
|
117
|
-
"rollup": "^2.
|
|
111
|
+
"eslint": "^8.3.0",
|
|
112
|
+
"lect": "^0.18.6",
|
|
113
|
+
"rollup": "^2.60.0",
|
|
118
114
|
"rollup-plugin-ascii": "^0.0.3",
|
|
119
115
|
"rollup-plugin-banner": "^0.2.1",
|
|
120
116
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
121
|
-
"rollup-plugin-dts": "^4.0.
|
|
117
|
+
"rollup-plugin-dts": "^4.0.1",
|
|
122
118
|
"rollup-plugin-terser": "^7.0.2",
|
|
123
|
-
"tap": "^15.
|
|
119
|
+
"tap": "^15.1.2",
|
|
124
120
|
"tslib": "^2.3.1",
|
|
125
|
-
"typescript": "^4.
|
|
121
|
+
"typescript": "^4.5.2"
|
|
126
122
|
},
|
|
127
123
|
"engines": {
|
|
128
|
-
"node": ">=
|
|
124
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
129
125
|
}
|
|
130
126
|
}
|