@aliexme/js-utils 2.1.2 → 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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(n,i,...r)=>{if(n.length===0||i.length===0||r.some(e=>e.length===0))return[];let t=n.filter(e=>i.includes(e));return r.forEach(e=>{t=t.filter(l=>e.includes(l))}),t};exports.arraysIntersection=o;
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 const arraysIntersection: <T>(array1: T[], array2: T[], ...arrays: T[][]) => T[];
1
+ export declare function arraysIntersection<T>(array1: T[], array2: T[], ...restArrays: T[][]): T[];
@@ -1,10 +1,11 @@
1
- const o = (n, i, ...l) => {
2
- if (n.length === 0 || i.length === 0 || l.some((e) => e.length === 0)) return [];
3
- let t = n.filter((e) => i.includes(e));
4
- return l.forEach((e) => {
5
- t = t.filter((c) => e.includes(c));
6
- }), t;
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
- o as arraysIntersection
10
+ i as arraysIntersection
10
11
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=(t,e)=>t.length===0||e.length===0?t:t.filter(r=>!e.includes(r));exports.subtractArrays=n;
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 const subtractArrays: <T>(array1: T[], array2: T[]) => T[];
1
+ export declare function subtractArrays<T>(mainArray: T[], arrayToSubstract: T[], ...restArraysToSubtract: T[][]): T[];
@@ -1,4 +1,9 @@
1
- const l = (t, e) => t.length === 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n));
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
- l as subtractArrays
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.2",
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": "b8a504e726d4d9ee140e45a422168e491bf6f984"
35
+ "gitHead": "c2cd72ec12f990b4c5928ab949c815419d7c4ccc"
36
36
  }