array-pull-all-with-glob 6.0.5 → 6.0.11
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 +1 -1
- package/README.md +4 -5
- package/dist/array-pull-all-with-glob.esm.js +2 -27
- package/dist/array-pull-all-with-glob.umd.js +2 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +23 -78
- package/types/index.d.ts +6 -2
- package/examples/api.json +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
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
|
-
|
|
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
|
|
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-
|
|
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.
|
|
4
|
+
* @version 6.0.11
|
|
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 {
|
|
11
|
-
|
|
12
|
-
var version$1 = "6.0.5";
|
|
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" ? [originalToBeRemoved] : Array.from(originalToBeRemoved);
|
|
23
|
-
const defaults = {
|
|
24
|
-
caseSensitive: true
|
|
25
|
-
};
|
|
26
|
-
const opts = { ...defaults,
|
|
27
|
-
...originalOpts
|
|
28
|
-
};
|
|
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.11";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.
|
|
4
|
+
* @version 6.0.11
|
|
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
|
-
|
|
10
|
+
var arrayPullAllWithGlob=(()=>{var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var m=(e,t,r)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,o=(e,t)=>{for(var r in t||(t={}))h.call(t,r)&&m(e,r,t[r]);if(g)for(var r of g(t))S.call(t,r)&&m(e,r,t[r]);return e};var E=e=>d(e,"__esModule",{value:!0});var $=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},j=(e,t,r,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of k(t))!h.call(e,s)&&(r||s!=="default")&&d(e,s,{get:()=>t[s],enumerable:!(l=v(t,s))||l.enumerable});return e};var A=(e=>(t,r)=>e&&e.get(t)||(r=j(E({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var D={};$(D,{pull:()=>C,version:()=>z});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,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(r=>{if(typeof r!="string"){if(typeof r=="undefined")return!1;throw new TypeError(`Expected '${t}' to be an array of strings, but found a type of '${typeof r}' in the array`)}return!0})},M=(e,t)=>{t=o({caseSensitive:!1},t);let r=e+JSON.stringify(t);if(y.has(r))return y.get(r);let l=e[0]==="!";l&&(e=e.slice(1)),e=f(e).replace(/\\\*/g,"[\\s\\S]*");let s=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return s.negated=l,y.set(r,s),s},O=(e,t,r,l)=>{if(e=b(e,"inputs"),t=b(t,"patterns"),t.length===0)return[];t=t.map(a=>M(a,r));let{allPatterns:s}=r||{},c=[];for(let a of e){let n,p=[...t].fill(!1);for(let[i,u]of t.entries())if(u.test(a)&&(p[i]=!0,n=!u.negated,!n))break;if(!(n===!1||n===void 0&&t.some(i=>!i.negated)||s&&p.some((i,u)=>!i&&!t[u].negated))&&(c.push(a),l))break}return c};function x(e,t,r){return O(e,t,r,!0).length>0}var w="6.0.11";var z=w;function C(e,t,r){if(!e.length)return[];if(!e.length||!t.length)return Array.from(e);let l=typeof t=="string"?[t]:Array.from(t),c=o(o({},{caseSensitive:!0}),r);return Array.from(e).filter(n=>!l.some(p=>x(n,p,{caseSensitive:c.caseSensitive})))}return A(D);})();
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "array-pull-all-with-glob",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.11",
|
|
4
4
|
"description": "Like _.pullAll but with globs (wildcards)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -38,94 +38,39 @@
|
|
|
38
38
|
},
|
|
39
39
|
"types": "types/index.d.ts",
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"tap": "tap",
|
|
56
|
-
"pretest": "npm run build",
|
|
57
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
58
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
59
|
-
"tsc": "tsc",
|
|
60
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
41
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
42
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
43
|
+
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|
|
44
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
45
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
46
|
+
"letspublish": "yarn publish || :",
|
|
47
|
+
"lint": "eslint . --fix",
|
|
48
|
+
"perf": "node perf/check.js",
|
|
49
|
+
"prepare": "echo 'ready'",
|
|
50
|
+
"prettier": "prettier",
|
|
51
|
+
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
52
|
+
"pretest": "yarn run lect && yarn run build",
|
|
53
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
54
|
+
"unit": "uvu test"
|
|
61
55
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"--no-warnings",
|
|
70
|
-
"--experimental-loader",
|
|
71
|
-
"@istanbuljs/esm-loader-hook"
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
58
|
+
},
|
|
59
|
+
"c8": {
|
|
60
|
+
"check-coverage": true,
|
|
61
|
+
"exclude": [
|
|
62
|
+
"**/test/**/*.*"
|
|
72
63
|
],
|
|
73
|
-
"
|
|
64
|
+
"lines": 100
|
|
74
65
|
},
|
|
75
66
|
"lect": {
|
|
76
67
|
"licence": {
|
|
77
68
|
"extras": [
|
|
78
69
|
""
|
|
79
70
|
]
|
|
80
|
-
},
|
|
81
|
-
"req": "{ pull }",
|
|
82
|
-
"various": {
|
|
83
|
-
"devDependencies": []
|
|
84
71
|
}
|
|
85
72
|
},
|
|
86
73
|
"dependencies": {
|
|
87
|
-
"@babel/runtime": "^7.16.0",
|
|
88
74
|
"matcher": "^5.0.0"
|
|
89
|
-
},
|
|
90
|
-
"devDependencies": {
|
|
91
|
-
"@babel/cli": "^7.16.0",
|
|
92
|
-
"@babel/core": "^7.16.0",
|
|
93
|
-
"@babel/node": "^7.16.0",
|
|
94
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
95
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
96
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
97
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
98
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
99
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
100
|
-
"@babel/preset-env": "^7.16.0",
|
|
101
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
102
|
-
"@babel/register": "^7.16.0",
|
|
103
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
104
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
105
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
106
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
107
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
108
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
109
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
110
|
-
"@types/node": "^16.11.6",
|
|
111
|
-
"@types/tap": "^15.0.5",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
113
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
114
|
-
"core-js": "^3.19.1",
|
|
115
|
-
"cross-env": "^7.0.3",
|
|
116
|
-
"eslint": "^8.2.0",
|
|
117
|
-
"lect": "^0.18.5",
|
|
118
|
-
"rollup": "^2.59.0",
|
|
119
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
120
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
121
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
122
|
-
"rollup-plugin-dts": "^4.0.1",
|
|
123
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
124
|
-
"tap": "^15.0.10",
|
|
125
|
-
"tslib": "^2.3.1",
|
|
126
|
-
"typescript": "^4.4.4"
|
|
127
|
-
},
|
|
128
|
-
"engines": {
|
|
129
|
-
"node": ">=12"
|
|
130
75
|
}
|
|
131
76
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
declare const version: string;
|
|
2
2
|
interface Opts {
|
|
3
|
-
|
|
3
|
+
caseSensitive?: boolean;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Like _.pullAll but with globs (wildcards)
|
|
7
7
|
*/
|
|
8
|
-
declare function pull(
|
|
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 { strict as assert } from \"assert\";\nimport { pull } 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);"}}
|