array-includes-with-glob 4.1.2 → 4.1.4

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 CHANGED
@@ -17,7 +17,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
17
17
 
18
18
  ### BREAKING CHANGES
19
19
 
20
- - programs now are in ES Modules and won't work with Common JS require()
20
+ - programs now are in ES Modules and won't work with Common JS `require()`
21
21
 
22
22
  ## 3.1.0 (2021-05-24)
23
23
 
@@ -33,9 +33,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
33
33
 
34
34
  ## 3.0.1 (2021-01-28)
35
35
 
36
- ### Bug Fixes
36
+ ### Fixed
37
37
 
38
- - add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
38
+ - add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
39
39
 
40
40
  ## 3.0.0 (2021-01-23)
41
41
 
@@ -49,7 +49,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
49
49
 
50
50
  ## 2.13.0 (2020-11-28)
51
51
 
52
- Accidental version bump during migration to sourcehut. Sorry about that.
52
+ Accidental version bump during migration to SourceHut. Sorry about that.
53
53
 
54
54
  ## 2.12.0 (2019-06-29)
55
55
 
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name array-includes-with-glob
3
3
  * @fileoverview Like _.includes but with wildcards
4
- * @version 4.1.2
4
+ * @version 4.1.4
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 u(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var y=new Map,f=(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(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${r}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},h=(e,r)=>{r={caseSensitive:!1,...r};let t=e+JSON.stringify(r);if(y.has(t))return y.get(t);let s=e[0]==="!";s&&(e=e.slice(1)),e=u(e).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${e}$`,r.caseSensitive?"":"i");return n.negated=s,y.set(t,n),n},m=(e,r,t,s)=>{if(e=f(e,"inputs"),r=f(r,"patterns"),r.length===0)return[];r=r.map(a=>h(a,t));let{allPatterns:n}=t||{},i=[];for(let a of e){let c,p=[...r].fill(!1);for(let[o,l]of r.entries())if(l.test(a)&&(p[o]=!0,c=!l.negated,!c))break;if(!(c===!1||c===void 0&&r.some(o=>!o.negated)||n&&p.some((o,l)=>!o&&!r[l].negated))&&(i.push(a),s))break}return i};function d(e,r,t){return m(e,r,t,!0).length>0}var g="4.1.2";var M=g,x={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function j(e,r,t){if(!e.length||!r.length)return!1;let s={...x,...t},n=typeof e=="string"?[e]:Array.from(e);return typeof r=="string"?n.some(i=>d(i,r,{caseSensitive:s.caseSensitive})):s.arrayVsArrayAllMustBeFound==="any"?r.some(i=>n.some(a=>d(a,i,{caseSensitive:s.caseSensitive}))):r.every(i=>n.some(a=>d(a,i,{caseSensitive:s.caseSensitive})))}export{x as defaults,j as includesWithGlob,M as version};
10
+ function u(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var y=new Map,f=(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(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${r}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},h=(e,r)=>{r={caseSensitive:!1,...r};let t=e+JSON.stringify(r);if(y.has(t))return y.get(t);let s=e[0]==="!";s&&(e=e.slice(1)),e=u(e).replace(/\\\*/g,"[\\s\\S]*");let n=new RegExp(`^${e}$`,r.caseSensitive?"":"i");return n.negated=s,y.set(t,n),n},m=(e,r,t,s)=>{if(e=f(e,"inputs"),r=f(r,"patterns"),r.length===0)return[];r=r.map(a=>h(a,t));let{allPatterns:n}=t||{},i=[];for(let a of e){let c,p=[...r].fill(!1);for(let[o,l]of r.entries())if(l.test(a)&&(p[o]=!0,c=!l.negated,!c))break;if(!(c===!1||c===void 0&&r.some(o=>!o.negated)||n&&p.some((o,l)=>!o&&!r[l].negated))&&(i.push(a),s))break}return i};function d(e,r,t){return m(e,r,t,!0).length>0}var g="4.1.4";var j=g,x={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function M(e,r,t){if(!e.length||!r.length)return!1;let s={...x,...t},n=typeof e=="string"?[e]:Array.from(e);return typeof r=="string"?n.some(i=>d(i,r,{caseSensitive:s.caseSensitive})):s.arrayVsArrayAllMustBeFound==="any"?r.some(i=>n.some(a=>d(a,i,{caseSensitive:s.caseSensitive}))):r.every(i=>n.some(a=>d(a,i,{caseSensitive:s.caseSensitive})))}export{x as defaults,M as includesWithGlob,j 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.1.2
4
+ * @version 4.1.4
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
- "use strict";var arrayIncludesWithGlob=(()=>{var u=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var m=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))b.call(e,t)&&m(r,t,e[t]);if(h)for(var t of h(e))A.call(e,t)&&m(r,t,e[t]);return r};var E=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},M=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!b.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(n=S(e,s))||n.enumerable});return r};var j=r=>M(u({},"__esModule",{value:!0}),r);var B={};E(B,{defaults:()=>w,includesWithGlob:()=>V,version:()=>F});function p(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var f=new Map,x=(r,e)=>{if(!Array.isArray(r))switch(typeof r){case"string":r=[r];break;case"undefined":r=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof r}'`)}return r.filter(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},$=(r,e)=>{e=c({caseSensitive:!1},e);let t=r+JSON.stringify(e);if(f.has(t))return f.get(t);let n=r[0]==="!";n&&(r=r.slice(1)),r=p(r).replace(/\\\*/g,"[\\s\\S]*");let s=new RegExp(`^${r}$`,e.caseSensitive?"":"i");return s.negated=n,f.set(t,s),s},R=(r,e,t,n)=>{if(r=x(r,"inputs"),e=x(e,"patterns"),e.length===0)return[];e=e.map(a=>$(a,t));let{allPatterns:s}=t||{},i=[];for(let a of r){let l,g=[...e].fill(!1);for(let[o,d]of e.entries())if(d.test(a)&&(g[o]=!0,l=!d.negated,!l))break;if(!(l===!1||l===void 0&&e.some(o=>!o.negated)||s&&g.some((o,d)=>!o&&!e[d].negated))&&(i.push(a),n))break}return i};function y(r,e,t){return R(r,e,t,!0).length>0}var v="4.1.2";var F=v,w={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function V(r,e,t){if(!r.length||!e.length)return!1;let n=c(c({},w),t),s=typeof r=="string"?[r]:Array.from(r);return typeof e=="string"?s.some(i=>y(i,e,{caseSensitive:n.caseSensitive})):n.arrayVsArrayAllMustBeFound==="any"?e.some(i=>s.some(a=>y(a,i,{caseSensitive:n.caseSensitive}))):e.every(i=>s.some(a=>y(a,i,{caseSensitive:n.caseSensitive})))}return j(B);})();
10
+ "use strict";var arrayIncludesWithGlob=(()=>{var u=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var m=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))b.call(e,t)&&m(r,t,e[t]);if(h)for(var t of h(e))A.call(e,t)&&m(r,t,e[t]);return r};var E=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},j=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!b.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(n=S(e,s))||n.enumerable});return r};var M=r=>j(u({},"__esModule",{value:!0}),r);var B={};E(B,{defaults:()=>w,includesWithGlob:()=>V,version:()=>F});function p(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var f=new Map,x=(r,e)=>{if(!Array.isArray(r))switch(typeof r){case"string":r=[r];break;case"undefined":r=[];break;default:throw new TypeError(`Expected '${e}' to be a string or an array, but got a type of '${typeof r}'`)}return r.filter(t=>{if(typeof t!="string"){if(typeof t>"u")return!1;throw new TypeError(`Expected '${e}' to be an array of strings, but found a type of '${typeof t}' in the array`)}return!0})},$=(r,e)=>{e=c({caseSensitive:!1},e);let t=r+JSON.stringify(e);if(f.has(t))return f.get(t);let n=r[0]==="!";n&&(r=r.slice(1)),r=p(r).replace(/\\\*/g,"[\\s\\S]*");let s=new RegExp(`^${r}$`,e.caseSensitive?"":"i");return s.negated=n,f.set(t,s),s},R=(r,e,t,n)=>{if(r=x(r,"inputs"),e=x(e,"patterns"),e.length===0)return[];e=e.map(a=>$(a,t));let{allPatterns:s}=t||{},i=[];for(let a of r){let l,g=[...e].fill(!1);for(let[o,d]of e.entries())if(d.test(a)&&(g[o]=!0,l=!d.negated,!l))break;if(!(l===!1||l===void 0&&e.some(o=>!o.negated)||s&&g.some((o,d)=>!o&&!e[d].negated))&&(i.push(a),n))break}return i};function y(r,e,t){return R(r,e,t,!0).length>0}var v="4.1.4";var F=v,w={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function V(r,e,t){if(!r.length||!e.length)return!1;let n=c(c({},w),t),s=typeof r=="string"?[r]:Array.from(r);return typeof e=="string"?s.some(i=>y(i,e,{caseSensitive:n.caseSensitive})):n.arrayVsArrayAllMustBeFound==="any"?e.some(i=>s.some(a=>y(a,i,{caseSensitive:n.caseSensitive}))):e.every(i=>s.some(a=>y(a,i,{caseSensitive:n.caseSensitive})))}return M(B);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "array-includes-with-glob",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "Like _.includes but with wildcards",
5
5
  "keywords": [
6
6
  "array",
@@ -45,7 +45,7 @@
45
45
  "examples": "node '../../ops/scripts/run-examples.js'",
46
46
  "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
47
47
  "letspublish": "yarn publish || :",
48
- "lint": "eslint . --fix",
48
+ "lint": "eslint . --ext .js --ext .ts --fix",
49
49
  "perf": "node perf/check.js",
50
50
  "prepare": "echo 'ready'",
51
51
  "prettier": "prettier",
@@ -1,14 +0,0 @@
1
- // Quick Take
2
-
3
- import { strict as assert } from "assert";
4
-
5
- import { includesWithGlob } from "../dist/array-includes-with-glob.esm.js";
6
-
7
- assert.equal(includesWithGlob(["xc", "yc", "zc"], "*c"), true);
8
- // (all 3)
9
-
10
- assert.equal(includesWithGlob(["xc", "yc", "zc"], "*a"), false);
11
- // (none found)
12
-
13
- assert.equal(includesWithGlob(["something", "anything", "zzz"], "some*"), true);
14
- // (1 hit)
@@ -1,26 +0,0 @@
1
- // `opts.arrayVsArrayAllMustBeFound`
2
-
3
- import { strict as assert } from "assert";
4
-
5
- import { includesWithGlob } from "../dist/array-includes-with-glob.esm.js";
6
-
7
- let source = ["aaa", "bbb", "ccc"];
8
- let whatToLookFor = ["a*", "d*"];
9
-
10
- // the default setting for opts.arrayVsArrayAllMustBeFound is "any"
11
- assert.equal(includesWithGlob(source, whatToLookFor), true);
12
- assert.equal(
13
- includesWithGlob(source, whatToLookFor, {
14
- arrayVsArrayAllMustBeFound: "any",
15
- }),
16
- true
17
- );
18
- // true, because one element, 'a*' was found in source (it was its first element)
19
-
20
- assert.equal(
21
- includesWithGlob(source, whatToLookFor, {
22
- arrayVsArrayAllMustBeFound: "all",
23
- }),
24
- false
25
- );
26
- // false, because not all elements were found, the 'd*' is missing