array-pull-all-with-glob 6.0.6 → 6.0.12

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 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
@@ -26,18 +26,17 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `5.1.0`.
30
30
 
31
31
  ```bash
32
32
  npm i array-pull-all-with-glob
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 5.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
40
38
  import { strict as assert } from "assert";
39
+
41
40
  import { pull } from "array-pull-all-with-glob";
42
41
 
43
42
  assert.deepEqual(
@@ -51,7 +50,7 @@ assert.deepEqual(
51
50
 
52
51
  ## Documentation
53
52
 
54
- Please [visit codsen.com](https://codsen.com/os/array-pull-all-with-glob/) for a full description of the API and examples.
53
+ Please [visit codsen.com](https://codsen.com/os/array-pull-all-with-glob/) for a full description of the API.
55
54
 
56
55
  ## Contributing
57
56
 
@@ -61,6 +60,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
61
60
 
62
61
  MIT License
63
62
 
64
- Copyright (c) 2010-2021 Roy Revelt and other contributors
63
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
65
64
 
66
65
  <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">
@@ -1,35 +1,10 @@
1
1
  /**
2
2
  * @name array-pull-all-with-glob
3
3
  * @fileoverview Like _.pullAll but with globs (wildcards)
4
- * @version 6.0.6
4
+ * @version 6.0.12
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/array-pull-all-with-glob/}
8
8
  */
9
9
 
10
- import { isMatch } from 'matcher';
11
-
12
- var version$1 = "6.0.6";
13
-
14
- const version = version$1;
15
- function pull(originalInput, originalToBeRemoved, originalOpts) {
16
- if (!originalInput.length) {
17
- return [];
18
- }
19
- if (!originalInput.length || !originalToBeRemoved.length) {
20
- return Array.from(originalInput);
21
- }
22
- const toBeRemoved = typeof originalToBeRemoved === "string"
23
- ? [originalToBeRemoved]
24
- : Array.from(originalToBeRemoved);
25
- const defaults = {
26
- caseSensitive: true,
27
- };
28
- const opts = { ...defaults, ...originalOpts };
29
- const res = Array.from(originalInput).filter((originalVal) => !toBeRemoved.some((remVal) => isMatch(originalVal, remVal, {
30
- caseSensitive: opts.caseSensitive,
31
- })));
32
- return res;
33
- }
34
-
35
- export { pull, version };
10
+ import{isMatch as o}from"matcher";var r="6.0.12";var h=r;function f(e,t,s){if(!e.length)return[];if(!e.length||!t.length)return Array.from(e);let l=typeof t=="string"?[t]:Array.from(t),n={...{caseSensitive:!0},...s};return Array.from(e).filter(i=>!l.some(a=>o(i,a,{caseSensitive:n.caseSensitive})))}export{f as pull,h as version};
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name array-pull-all-with-glob
3
3
  * @fileoverview Like _.pullAll but with globs (wildcards)
4
- * @version 6.0.6
4
+ * @version 6.0.12
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/array-pull-all-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).arrayPullAllWithGlob={})}(this,(function(e){"use strict";const t=new Map,r=(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}))},n=(e,r)=>{r={caseSensitive:!1,...r};const n=e+JSON.stringify(r);if(t.has(n))return t.get(n);const o="!"===e[0];o&&(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}$`,r.caseSensitive?"":"i");return i.negated=o,t.set(n,i),i};function o(e,t,o){return((e,t,o,i)=>{if(e=r(e,"inputs"),0===(t=r(t,"patterns")).length)return[];t=t.map((e=>n(e,o)));const{allPatterns:s}=o||{},f=[];for(const r of e){let e;const n=[...t].fill(!1);for(const[o,i]of t.entries())if(i.test(r)&&(n[o]=!0,e=!i.negated,!e))break;if(!(!1===e||void 0===e&&t.some((e=>!e.negated))||s&&n.some(((e,r)=>!e&&!t[r].negated)))&&(f.push(r),i))break}return f})(e,t,o,!0).length>0}e.pull=function(e,t,r){if(!e.length)return[];if(!e.length||!t.length)return Array.from(e);const n="string"==typeof t?[t]:Array.from(t),i={caseSensitive:!0,...r};return Array.from(e).filter((e=>!n.some((t=>o(e,t,{caseSensitive:i.caseSensitive})))))},e.version="6.0.6",Object.defineProperty(e,"__esModule",{value:!0})}));
10
+ var arrayPullAllWithGlob=(()=>{var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var m=(e,r,t)=>r in e?d(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,o=(e,r)=>{for(var t in r||(r={}))h.call(r,t)&&m(e,t,r[t]);if(g)for(var t of g(r))E.call(r,t)&&m(e,t,r[t]);return e};var S=e=>d(e,"__esModule",{value:!0});var j=(e,r)=>{for(var t in r)d(e,t,{get:r[t],enumerable:!0})},A=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of k(r))!h.call(e,s)&&(t||s!=="default")&&d(e,s,{get:()=>r[s],enumerable:!(n=v(r,s))||n.enumerable});return e};var $=(e=>(r,t)=>e&&e.get(r)||(t=A(S({}),r,1),e&&e.set(r,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var C={};j(C,{pull:()=>z,version:()=>D});function f(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var y=new Map,b=(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=="undefined")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})},M=(e,r)=>{r=o({caseSensitive:!1},r);let t=e+JSON.stringify(r);if(y.has(t))return y.get(t);let n=e[0]==="!";n&&(e=e.slice(1)),e=f(e).replace(/\\\*/g,"[\\s\\S]*");let s=new RegExp(`^${e}$`,r.caseSensitive?"":"i");return s.negated=n,y.set(t,s),s},O=(e,r,t,n)=>{if(e=b(e,"inputs"),r=b(r,"patterns"),r.length===0)return[];r=r.map(a=>M(a,t));let{allPatterns:s}=t||{},c=[];for(let a of e){let l,u=[...r].fill(!1);for(let[i,p]of r.entries())if(p.test(a)&&(u[i]=!0,l=!p.negated,!l))break;if(!(l===!1||l===void 0&&r.some(i=>!i.negated)||s&&u.some((i,p)=>!i&&!r[p].negated))&&(c.push(a),n))break}return c};function x(e,r,t){return O(e,r,t,!0).length>0}var w="6.0.12";var D=w;function z(e,r,t){if(!e.length)return[];if(!e.length||!r.length)return Array.from(e);let n=typeof r=="string"?[r]:Array.from(r),c=o(o({},{caseSensitive:!0}),t);return Array.from(e).filter(l=>!n.some(u=>x(l,u,{caseSensitive:c.caseSensitive})))}return $(C);})();
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { pull } from "../dist/array-pull-all-with-glob.esm.js";
5
6
 
6
7
  assert.deepEqual(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "array-pull-all-with-glob",
3
- "version": "6.0.6",
3
+ "version": "6.0.12",
4
4
  "description": "Like _.pullAll but with globs (wildcards)",
5
5
  "keywords": [
6
6
  "array",
@@ -38,90 +38,40 @@
38
38
  },
39
39
  "types": "types/index.d.ts",
40
40
  "scripts": {
41
- "build": "rollup -c",
42
- "build:esbuild": "node '../../scripts/esbuild.js'",
43
- "build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
44
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
45
- "clean_types": "../../scripts/cleanTypes.js",
46
- "dev": "rollup -c --dev",
47
- "devunittest": "npm run dev && tap --only -R 'base'",
48
- "format": "npm run lect && npm run prettier && npm run lint",
49
- "lect": "lect",
50
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
51
- "perf": "node perf/check",
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 test:ci && npm run perf",
57
- "test:ci": "npm run unittest && npm run test:examples && npm run format",
58
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
59
- "tsc": "tsc",
60
- "unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
41
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
42
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
43
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
44
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
45
+ "examples": "node '../../ops/scripts/run-examples.js'",
46
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
47
+ "letspublish": "yarn publish || :",
48
+ "lint": "eslint . --fix",
49
+ "perf": "node perf/check.js",
50
+ "prepare": "echo 'ready'",
51
+ "prettier": "prettier",
52
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
53
+ "pretest": "yarn run lect && yarn run build",
54
+ "test": "yarn run devtest",
55
+ "unit": "uvu test"
61
56
  },
62
- "tap": {
63
- "check-coverage": false,
64
- "node-arg": [
65
- "--no-warnings",
66
- "--experimental-loader",
67
- "@istanbuljs/esm-loader-hook"
57
+ "engines": {
58
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
59
+ },
60
+ "c8": {
61
+ "check-coverage": true,
62
+ "exclude": [
63
+ "**/test/**/*.*"
68
64
  ],
69
- "timeout": 0
65
+ "lines": 100
70
66
  },
71
67
  "lect": {
72
68
  "licence": {
73
69
  "extras": [
74
70
  ""
75
71
  ]
76
- },
77
- "req": "{ pull }",
78
- "various": {
79
- "devDependencies": []
80
72
  }
81
73
  },
82
74
  "dependencies": {
83
- "@babel/runtime": "^7.16.3",
84
75
  "matcher": "^5.0.0"
85
- },
86
- "devDependencies": {
87
- "@babel/cli": "^7.16.0",
88
- "@babel/core": "^7.16.0",
89
- "@babel/node": "^7.16.0",
90
- "@babel/plugin-external-helpers": "^7.16.0",
91
- "@babel/plugin-proposal-class-properties": "^7.16.0",
92
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
93
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
94
- "@babel/plugin-proposal-optional-chaining": "^7.16.0",
95
- "@babel/plugin-transform-runtime": "^7.16.4",
96
- "@babel/preset-env": "^7.16.4",
97
- "@babel/preset-typescript": "^7.16.0",
98
- "@babel/register": "^7.16.0",
99
- "@istanbuljs/esm-loader-hook": "^0.1.2",
100
- "@rollup/plugin-babel": "^5.3.0",
101
- "@rollup/plugin-commonjs": "^21.0.1",
102
- "@rollup/plugin-json": "^4.1.0",
103
- "@rollup/plugin-node-resolve": "^13.0.6",
104
- "@rollup/plugin-strip": "^2.1.0",
105
- "@rollup/plugin-typescript": "^8.3.0",
106
- "@types/node": "^16.11.9",
107
- "@types/tap": "^15.0.5",
108
- "@typescript-eslint/eslint-plugin": "^5.4.0",
109
- "@typescript-eslint/parser": "^5.4.0",
110
- "core-js": "^3.19.1",
111
- "cross-env": "^7.0.3",
112
- "eslint": "^8.3.0",
113
- "lect": "^0.18.6",
114
- "rollup": "^2.60.0",
115
- "rollup-plugin-ascii": "^0.0.3",
116
- "rollup-plugin-banner": "^0.2.1",
117
- "rollup-plugin-cleanup": "^3.2.1",
118
- "rollup-plugin-dts": "^4.0.1",
119
- "rollup-plugin-terser": "^7.0.2",
120
- "tap": "^15.1.2",
121
- "tslib": "^2.3.1",
122
- "typescript": "^4.5.2"
123
- },
124
- "engines": {
125
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
126
76
  }
127
77
  }
package/types/index.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  declare const version: string;
2
2
  interface Opts {
3
- caseSensitive?: boolean;
3
+ caseSensitive?: boolean;
4
4
  }
5
5
  /**
6
6
  * Like _.pullAll but with globs (wildcards)
7
7
  */
8
- declare function pull(originalInput: string[], originalToBeRemoved: string | string[], originalOpts?: Opts): string[];
8
+ declare function pull(
9
+ originalInput: string[],
10
+ originalToBeRemoved: string | string[],
11
+ originalOpts?: Opts
12
+ ): string[];
9
13
 
10
14
  export { pull, version };
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; pull &#x7D; from \"array-pull-all-with-glob\";\n\nassert.deepEqual(\n pull(\n [\"keep_me\", \"name-1\", \"name-2\", \"name-jhkgdhgkhdfghdkghfdk\"],\n [\"name-*\"]\n ),\n [\"keep_me\"]\n);"}}