array-includes-with-glob 4.0.4 → 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/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/README.md +5 -2
- package/dist/array-includes-with-glob.esm.js +2 -34
- package/dist/array-includes-with-glob.umd.js +2 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +21 -81
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +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.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 4.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 4.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
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
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# array-includes-with-glob
|
|
2
2
|
|
|
3
|
-
> Like
|
|
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
|
|
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,42 +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.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
|
-
|
|
11
|
-
|
|
12
|
-
var version$1 = "4.0.4";
|
|
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,
|
|
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
|
|
35
|
-
})));
|
|
36
|
-
}
|
|
37
|
-
return stringToFind.every(stringToFindVal => input.some(val => isMatch(val, stringToFindVal, {
|
|
38
|
-
caseSensitive: opts.caseSensitive
|
|
39
|
-
})));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
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.
|
|
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
|
-
|
|
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);})();
|
package/examples/_quickTake.js
CHANGED
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.10",
|
|
4
4
|
"description": "Like _.includes but with wildcards",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -37,94 +37,34 @@
|
|
|
37
37
|
},
|
|
38
38
|
"types": "types/index.d.ts",
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
53
|
-
"republish": "npm publish || :",
|
|
54
|
-
"tap": "tap",
|
|
55
|
-
"pretest": "npm run build",
|
|
56
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
57
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
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"
|
|
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
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"--no-warnings",
|
|
69
|
-
"--experimental-loader",
|
|
70
|
-
"@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/**/*.*"
|
|
71
60
|
],
|
|
72
|
-
"
|
|
61
|
+
"lines": 100
|
|
73
62
|
},
|
|
74
63
|
"lect": {
|
|
75
64
|
"licence": {
|
|
76
65
|
"extras": [
|
|
77
66
|
""
|
|
78
67
|
]
|
|
79
|
-
},
|
|
80
|
-
"req": "{ includesWithGlob }",
|
|
81
|
-
"various": {
|
|
82
|
-
"devDependencies": []
|
|
83
68
|
}
|
|
84
|
-
},
|
|
85
|
-
"dependencies": {
|
|
86
|
-
"@babel/runtime": "^7.16.0",
|
|
87
|
-
"matcher": "^5.0.0"
|
|
88
|
-
},
|
|
89
|
-
"devDependencies": {
|
|
90
|
-
"@babel/cli": "^7.16.0",
|
|
91
|
-
"@babel/core": "^7.16.0",
|
|
92
|
-
"@babel/node": "^7.16.0",
|
|
93
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
94
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
95
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
96
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
97
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
98
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
99
|
-
"@babel/preset-env": "^7.16.0",
|
|
100
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
101
|
-
"@babel/register": "^7.16.0",
|
|
102
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
103
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
104
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
105
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
106
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
107
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
108
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
109
|
-
"@types/node": "^16.11.6",
|
|
110
|
-
"@types/tap": "^15.0.5",
|
|
111
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
112
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
113
|
-
"core-js": "^3.19.1",
|
|
114
|
-
"cross-env": "^7.0.3",
|
|
115
|
-
"eslint": "^8.1.0",
|
|
116
|
-
"lect": "^0.18.4",
|
|
117
|
-
"rollup": "^2.59.0",
|
|
118
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
119
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
120
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
121
|
-
"rollup-plugin-dts": "^4.0.0",
|
|
122
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
123
|
-
"tap": "^15.0.10",
|
|
124
|
-
"tslib": "^2.3.1",
|
|
125
|
-
"typescript": "^4.4.4"
|
|
126
|
-
},
|
|
127
|
-
"engines": {
|
|
128
|
-
"node": ">=12"
|
|
129
69
|
}
|
|
130
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 { strict as assert } from \"assert\";\nimport { includesWithGlob } 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)"}}
|