array-includes-with-glob 4.0.7 → 4.0.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # array-includes-with-glob
2
2
 
3
- > Like \_.includes but with wildcards
3
+ > Like _.includes but with wildcards
4
4
 
5
5
  <div class="package-badges">
6
6
  <a href="https://www.npmjs.com/package/array-includes-with-glob" rel="nofollow noreferrer noopener">
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 3.1.0
38
38
 
39
39
  ```js
40
40
  import { strict as assert } from "assert";
41
+
41
42
  import { includesWithGlob } from "array-includes-with-glob";
42
43
 
43
44
  assert.equal(includesWithGlob(["xc", "yc", "zc"], "*c"), true);
@@ -52,7 +53,7 @@ assert.equal(includesWithGlob(["something", "anything", "zzz"], "some*"), true);
52
53
 
53
54
  ## Documentation
54
55
 
55
- Please [visit codsen.com](https://codsen.com/os/array-includes-with-glob/) for a full description of the API and examples.
56
+ Please [visit codsen.com](https://codsen.com/os/array-includes-with-glob/) for a full description of the API.
56
57
 
57
58
  ## Contributing
58
59
 
@@ -64,4 +65,6 @@ MIT License
64
65
 
65
66
  Copyright (c) 2010-2021 Roy Revelt and other contributors
66
67
 
68
+
67
69
  <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
70
+
@@ -1,40 +1,10 @@
1
1
  /**
2
2
  * @name array-includes-with-glob
3
3
  * @fileoverview Like _.includes but with wildcards
4
- * @version 4.0.7
4
+ * @version 4.0.10
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 { isMatch } from 'matcher';
11
-
12
- var version$1 = "4.0.7";
13
-
14
- const version = version$1;
15
- const defaults = {
16
- arrayVsArrayAllMustBeFound: "any",
17
- caseSensitive: true,
18
- };
19
- function includesWithGlob(originalInput, stringToFind, originalOpts) {
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,
37
- })));
38
- }
39
-
40
- export { defaults, includesWithGlob, version };
10
+ function d(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var f=new Map,p=(e,r)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${r}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(s=>{if(typeof s!="string"){if(typeof s=="undefined")return!1;throw new TypeError(`Expected '${r}' to be an array of strings, but found a type of '${typeof s}' in the array`)}return!0})},h=(e,r)=>{r={caseSensitive:!1,...r};let s=e+JSON.stringify(r);if(f.has(s))return f.get(s);let t=e[0]==="!";t&&(e=e.slice(1)),e=d(e).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${e}$`,r.caseSensitive?"":"i");return n.negated=t,f.set(s,n),n},m=(e,r,s,t)=>{if(e=p(e,"inputs"),r=p(r,"patterns"),r.length===0)return[];r=r.map(i=>h(i,s));let{allPatterns:n}=s||{},a=[];for(let i of e){let c,y=[...r].fill(!1);for(let[o,l]of r.entries())if(l.test(i)&&(y[o]=!0,c=!l.negated,!c))break;if(!(c===!1||c===void 0&&r.some(o=>!o.negated)||n&&y.some((o,l)=>!o&&!r[l].negated))&&(a.push(i),t))break}return a};function u(e,r,s){return m(e,r,s,!0).length>0}var g="4.0.10";var M=g,x={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function $(e,r,s){if(!e.length||!r.length)return!1;let t={...x,...s},n=typeof e=="string"?[e]:Array.from(e);return typeof r=="string"?n.some(a=>u(a,r,{caseSensitive:t.caseSensitive})):t.arrayVsArrayAllMustBeFound==="any"?r.some(a=>n.some(i=>u(i,a,{caseSensitive:t.caseSensitive}))):r.every(a=>n.some(i=>u(i,a,{caseSensitive:t.caseSensitive})))}export{x as defaults,$ as includesWithGlob,M as 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.7
4
+ * @version 4.0.10
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.7",Object.defineProperty(e,"__esModule",{value:!0})}));
10
+ var arrayIncludesWithGlob=(()=>{var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var m=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var b=(e,r,s)=>r in e?d(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,c=(e,r)=>{for(var s in r||(r={}))m.call(r,s)&&b(e,s,r[s]);if(h)for(var s of h(r))A.call(r,s)&&b(e,s,r[s]);return e};var E=e=>d(e,"__esModule",{value:!0});var M=(e,r)=>{for(var s in r)d(e,s,{get:r[s],enumerable:!0})},$=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of k(r))!m.call(e,t)&&(s||t!=="default")&&d(e,t,{get:()=>r[t],enumerable:!(n=S(r,t))||n.enumerable});return e};var j=(e=>(r,s)=>e&&e.get(r)||(s=$(E({}),r,1),e&&e.set(r,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var C={};M(C,{defaults:()=>w,includesWithGlob:()=>z,version:()=>B});function y(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var p=new Map,x=(e,r)=>{if(!Array.isArray(e))switch(typeof e){case"string":e=[e];break;case"undefined":e=[];break;default:throw new TypeError(`Expected '${r}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(s=>{if(typeof s!="string"){if(typeof s=="undefined")return!1;throw new TypeError(`Expected '${r}' to be an array of strings, but found a type of '${typeof s}' in the array`)}return!0})},R=(e,r)=>{r=c({caseSensitive:!1},r);let s=e+JSON.stringify(r);if(p.has(s))return p.get(s);let n=e[0]==="!";n&&(e=e.slice(1)),e=y(e).replace(/\\\*/g,"[\\s\\S]*");let t=new RegExp(`^${e}$`,r.caseSensitive?"":"i");return t.negated=n,p.set(s,t),t},O=(e,r,s,n)=>{if(e=x(e,"inputs"),r=x(r,"patterns"),r.length===0)return[];r=r.map(i=>R(i,s));let{allPatterns:t}=s||{},a=[];for(let i of e){let l,g=[...r].fill(!1);for(let[o,u]of r.entries())if(u.test(i)&&(g[o]=!0,l=!u.negated,!l))break;if(!(l===!1||l===void 0&&r.some(o=>!o.negated)||t&&g.some((o,u)=>!o&&!r[u].negated))&&(a.push(i),n))break}return a};function f(e,r,s){return O(e,r,s,!0).length>0}var v="4.0.10";var B=v,w={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function z(e,r,s){if(!e.length||!r.length)return!1;let n=c(c({},w),s),t=typeof e=="string"?[e]:Array.from(e);return typeof r=="string"?t.some(a=>f(a,r,{caseSensitive:n.caseSensitive})):n.arrayVsArrayAllMustBeFound==="any"?r.some(a=>t.some(i=>f(i,a,{caseSensitive:n.caseSensitive}))):r.every(a=>t.some(i=>f(i,a,{caseSensitive:n.caseSensitive})))}return j(C);})();
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { includesWithGlob } from "../dist/array-includes-with-glob.esm.js";
5
6
 
6
7
  assert.equal(includesWithGlob(["xc", "yc", "zc"], "*c"), true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "array-includes-with-glob",
3
- "version": "4.0.7",
3
+ "version": "4.0.10",
4
4
  "description": "Like _.includes but with wildcards",
5
5
  "keywords": [
6
6
  "array",
@@ -37,90 +37,34 @@
37
37
  },
38
38
  "types": "types/index.d.ts",
39
39
  "scripts": {
40
- "build": "rollup -c",
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",
45
- "dev": "rollup -c --dev",
46
- "devunittest": "npm run dev && tap --only -R 'base'",
47
- "format": "npm run lect && npm run prettier && npm run lint",
48
- "lect": "lect",
49
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
50
- "perf": "node perf/check",
51
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
52
- "republish": "npm publish || :",
53
- "tap": "tap",
54
- "pretest": "npm run build",
55
- "test": "npm run test:ci && npm run perf",
56
- "test:ci": "npm run unittest && npm run test:examples && npm run format",
57
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
58
- "tsc": "tsc",
59
- "unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
40
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
41
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
42
+ "dts": "rollup -c",
43
+ "examples": "node '../../ops/scripts/run-examples.js'",
44
+ "lect": "node '../../ops/lect/lect.js'",
45
+ "letspublish": "yarn publish || :",
46
+ "lint": "eslint . --fix",
47
+ "perf": "node perf/check.js",
48
+ "prepare": "echo 'ready'",
49
+ "pretest": "yarn run lect && yarn run build",
50
+ "test": "c8 yarn run unit && yarn run examples && yarn run lint",
51
+ "unit": "uvu test"
60
52
  },
61
- "tap": {
62
- "check-coverage": false,
63
- "node-arg": [
64
- "--no-warnings",
65
- "--experimental-loader",
66
- "@istanbuljs/esm-loader-hook"
53
+ "engines": {
54
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
55
+ },
56
+ "c8": {
57
+ "check-coverage": true,
58
+ "exclude": [
59
+ "**/test/**/*.*"
67
60
  ],
68
- "timeout": 0
61
+ "lines": 100
69
62
  },
70
63
  "lect": {
71
64
  "licence": {
72
65
  "extras": [
73
66
  ""
74
67
  ]
75
- },
76
- "req": "{ includesWithGlob }",
77
- "various": {
78
- "devDependencies": []
79
68
  }
80
- },
81
- "dependencies": {
82
- "@babel/runtime": "^7.16.3",
83
- "matcher": "^5.0.0"
84
- },
85
- "devDependencies": {
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",
98
- "@istanbuljs/esm-loader-hook": "^0.1.2",
99
- "@rollup/plugin-babel": "^5.3.0",
100
- "@rollup/plugin-commonjs": "^21.0.1",
101
- "@rollup/plugin-json": "^4.1.0",
102
- "@rollup/plugin-node-resolve": "^13.0.6",
103
- "@rollup/plugin-strip": "^2.1.0",
104
- "@rollup/plugin-typescript": "^8.3.0",
105
- "@types/node": "^16.11.10",
106
- "@types/tap": "^15.0.5",
107
- "@typescript-eslint/eslint-plugin": "^5.5.0",
108
- "@typescript-eslint/parser": "^5.5.0",
109
- "core-js": "^3.19.2",
110
- "cross-env": "^7.0.3",
111
- "eslint": "^8.3.0",
112
- "lect": "^0.18.7",
113
- "rollup": "^2.60.1",
114
- "rollup-plugin-ascii": "^0.0.3",
115
- "rollup-plugin-banner": "^0.2.1",
116
- "rollup-plugin-cleanup": "^3.2.1",
117
- "rollup-plugin-dts": "^4.0.1",
118
- "rollup-plugin-terser": "^7.0.2",
119
- "tap": "^15.1.5",
120
- "tslib": "^2.3.1",
121
- "typescript": "^4.5.2"
122
- },
123
- "engines": {
124
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
125
69
  }
126
70
  }
package/types/index.d.ts CHANGED
File without changes
package/examples/api.json DELETED
@@ -1 +0,0 @@
1
- {"_quickTake.js":{"title":"Quick Take","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B; includesWithGlob &#x7D; from \"array-includes-with-glob\";\n\nassert.equal(includesWithGlob([\"xc\", \"yc\", \"zc\"], \"*c\"), true);\n// (all 3)\n\nassert.equal(includesWithGlob([\"xc\", \"yc\", \"zc\"], \"*a\"), false);\n// (none found)\n\nassert.equal(includesWithGlob([\"something\", \"anything\", \"zzz\"], \"some*\"), true);\n// (1 hit)"}}