array-includes-with-glob 4.0.5 → 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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name array-includes-with-glob
3
3
  * @fileoverview Like _.includes but with wildcards
4
- * @version 4.0.5
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/}
@@ -9,34 +9,32 @@
9
9
 
10
10
  import { isMatch } from 'matcher';
11
11
 
12
- var version$1 = "4.0.5";
12
+ var version$1 = "4.0.6";
13
13
 
14
14
  const version = version$1;
15
15
  const defaults = {
16
- arrayVsArrayAllMustBeFound: "any",
17
- caseSensitive: true
16
+ arrayVsArrayAllMustBeFound: "any",
17
+ caseSensitive: true,
18
18
  };
19
19
  function includesWithGlob(originalInput, stringToFind, originalOpts) {
20
- if (!originalInput.length || !stringToFind.length) {
21
- return false;
22
- }
23
- const opts = { ...defaults,
24
- ...originalOpts
25
- };
26
- const input = typeof originalInput === "string" ? [originalInput] : Array.from(originalInput);
27
- if (typeof stringToFind === "string") {
28
- return input.some(val => isMatch(val, stringToFind, {
29
- caseSensitive: opts.caseSensitive
30
- }));
31
- }
32
- if (opts.arrayVsArrayAllMustBeFound === "any") {
33
- return stringToFind.some(stringToFindVal => input.some(val => isMatch(val, stringToFindVal, {
34
- caseSensitive: opts.caseSensitive
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 => 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.5
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";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.5",Object.defineProperty(e,"__esModule",{value:!0})}));
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.5",
3
+ "version": "4.0.6",
4
4
  "description": "Like _.includes but with wildcards",
5
5
  "keywords": [
6
6
  "array",
@@ -38,13 +38,12 @@
38
38
  "types": "types/index.d.ts",
39
39
  "scripts": {
40
40
  "build": "rollup -c",
41
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
42
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
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",
43
44
  "clean_types": "../../scripts/cleanTypes.js",
44
45
  "dev": "rollup -c --dev",
45
46
  "devunittest": "npm run dev && tap --only -R 'base'",
46
- "esbuild": "node '../../scripts/esbuild.js'",
47
- "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
48
47
  "format": "npm run lect && npm run prettier && npm run lint",
49
48
  "lect": "lect",
50
49
  "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
@@ -53,17 +52,14 @@
53
52
  "republish": "npm publish || :",
54
53
  "tap": "tap",
55
54
  "pretest": "npm run build",
56
- "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
55
+ "test": "npm run test:ci && npm run perf",
56
+ "test:ci": "npm run unittest && npm run test:examples && npm run format",
57
57
  "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
58
58
  "tsc": "tsc",
59
- "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
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,7 +79,7 @@
83
79
  }
84
80
  },
85
81
  "dependencies": {
86
- "@babel/runtime": "^7.16.0",
82
+ "@babel/runtime": "^7.16.3",
87
83
  "matcher": "^5.0.0"
88
84
  },
89
85
  "devDependencies": {
@@ -95,8 +91,8 @@
95
91
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
96
92
  "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
97
93
  "@babel/plugin-proposal-optional-chaining": "^7.16.0",
98
- "@babel/plugin-transform-runtime": "^7.16.0",
99
- "@babel/preset-env": "^7.16.0",
94
+ "@babel/plugin-transform-runtime": "^7.16.4",
95
+ "@babel/preset-env": "^7.16.4",
100
96
  "@babel/preset-typescript": "^7.16.0",
101
97
  "@babel/register": "^7.16.0",
102
98
  "@istanbuljs/esm-loader-hook": "^0.1.2",
@@ -106,25 +102,25 @@
106
102
  "@rollup/plugin-node-resolve": "^13.0.6",
107
103
  "@rollup/plugin-strip": "^2.1.0",
108
104
  "@rollup/plugin-typescript": "^8.3.0",
109
- "@types/node": "^16.11.6",
105
+ "@types/node": "^16.11.9",
110
106
  "@types/tap": "^15.0.5",
111
- "@typescript-eslint/eslint-plugin": "^5.3.0",
112
- "@typescript-eslint/parser": "^5.3.0",
107
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
108
+ "@typescript-eslint/parser": "^5.4.0",
113
109
  "core-js": "^3.19.1",
114
110
  "cross-env": "^7.0.3",
115
- "eslint": "^8.2.0",
116
- "lect": "^0.18.5",
117
- "rollup": "^2.59.0",
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
117
  "rollup-plugin-dts": "^4.0.1",
122
118
  "rollup-plugin-terser": "^7.0.2",
123
- "tap": "^15.0.10",
119
+ "tap": "^15.1.2",
124
120
  "tslib": "^2.3.1",
125
- "typescript": "^4.4.4"
121
+ "typescript": "^4.5.2"
126
122
  },
127
123
  "engines": {
128
- "node": ">=12"
124
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
129
125
  }
130
126
  }