@aliexme/js-utils 2.1.1 → 2.1.3
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/dist/array/arraysIntersection.cjs +1 -1
- package/dist/array/arraysIntersection.d.ts +1 -1
- package/dist/array/arraysIntersection.js +9 -8
- package/dist/array/subtractArrays.cjs +1 -1
- package/dist/array/subtractArrays.d.ts +1 -1
- package/dist/array/subtractArrays.js +7 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(n,o,...r){if(n.length===0||o.length===0||r.some(t=>t.length===0))return[];const e=new Set(n),s=[o,...r];for(const t of s)for(const i of e)t.includes(i)||e.delete(i);return Array.from(e)}exports.arraysIntersection=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function arraysIntersection<T>(array1: T[], array2: T[], ...restArrays: T[][]): T[];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
if (n.length === 0 ||
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function i(n, o, ...r) {
|
|
2
|
+
if (n.length === 0 || o.length === 0 || r.some((t) => t.length === 0)) return [];
|
|
3
|
+
const e = new Set(n), f = [o, ...r];
|
|
4
|
+
for (const t of f)
|
|
5
|
+
for (const c of e)
|
|
6
|
+
t.includes(c) || e.delete(c);
|
|
7
|
+
return Array.from(e);
|
|
8
|
+
}
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
i as arraysIntersection
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(t,e,...r){if(t.length===0)return[];if(e.length===0)return[...t];const n=[e,...r],s=new Set(n.flat());return t.filter(u=>!s.has(u))}exports.subtractArrays=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function subtractArrays<T>(mainArray: T[], arrayToSubstract: T[], ...restArraysToSubtract: T[][]): T[];
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
function c(t, e, ...n) {
|
|
2
|
+
if (t.length === 0) return [];
|
|
3
|
+
if (e.length === 0) return [...t];
|
|
4
|
+
const r = [e, ...n], s = new Set(r.flat());
|
|
5
|
+
return t.filter((u) => !s.has(u));
|
|
6
|
+
}
|
|
2
7
|
export {
|
|
3
|
-
|
|
8
|
+
c as subtractArrays
|
|
4
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliexme/js-utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Common JavaScript utilities",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Alexander Smirnov <al.smirnov996@gmail.com>",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"build": "vite build",
|
|
33
33
|
"ts:check": "tsc --noEmit"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c2cd72ec12f990b4c5928ab949c815419d7c4ccc"
|
|
36
36
|
}
|