@etsoo/shared 1.2.51 → 1.2.54

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.
Files changed (94) hide show
  1. package/.github/workflows/main.yml +6 -5
  2. package/README.md +1 -1
  3. package/lib/cjs/ActionResult.d.ts +1 -1
  4. package/lib/cjs/ActionResult.js +3 -3
  5. package/lib/cjs/ArrayUtils.d.ts +1 -1
  6. package/lib/cjs/ArrayUtils.js +4 -4
  7. package/lib/cjs/ColorUtils.d.ts +1 -1
  8. package/lib/cjs/ColorUtils.js +2 -2
  9. package/lib/cjs/DataTypes.d.ts +6 -6
  10. package/lib/cjs/DataTypes.js +50 -51
  11. package/lib/cjs/DateUtils.d.ts +1 -1
  12. package/lib/cjs/DateUtils.js +27 -28
  13. package/lib/cjs/DomUtils.d.ts +3 -3
  14. package/lib/cjs/DomUtils.js +64 -73
  15. package/lib/cjs/ExtendUtils.d.ts +1 -1
  16. package/lib/cjs/ExtendUtils.js +6 -6
  17. package/lib/cjs/IActionResult.d.ts +15 -2
  18. package/lib/cjs/NumberUtils.d.ts +1 -1
  19. package/lib/cjs/NumberUtils.js +9 -9
  20. package/lib/cjs/StorageUtils.js +2 -2
  21. package/lib/cjs/Utils.d.ts +4 -4
  22. package/lib/cjs/Utils.js +58 -62
  23. package/lib/cjs/index.d.ts +22 -22
  24. package/lib/cjs/storage/WindowStorage.d.ts +1 -1
  25. package/lib/cjs/types/ContentDisposition.d.ts +2 -2
  26. package/lib/cjs/types/ContentDisposition.js +11 -13
  27. package/lib/cjs/types/EColor.js +5 -7
  28. package/lib/cjs/types/EHistory.d.ts +3 -3
  29. package/lib/cjs/types/EHistory.js +4 -4
  30. package/lib/cjs/types/ErrorData.d.ts +1 -1
  31. package/lib/cjs/types/EventClass.js +1 -1
  32. package/lib/mjs/ActionResult.d.ts +1 -1
  33. package/lib/mjs/ActionResult.js +3 -3
  34. package/lib/mjs/ArrayUtils.d.ts +1 -1
  35. package/lib/mjs/ArrayUtils.js +5 -5
  36. package/lib/mjs/ColorUtils.d.ts +1 -1
  37. package/lib/mjs/ColorUtils.js +3 -3
  38. package/lib/mjs/DataTypes.d.ts +6 -6
  39. package/lib/mjs/DataTypes.js +50 -51
  40. package/lib/mjs/DateUtils.d.ts +1 -1
  41. package/lib/mjs/DateUtils.js +27 -28
  42. package/lib/mjs/DomUtils.d.ts +3 -3
  43. package/lib/mjs/DomUtils.js +67 -76
  44. package/lib/mjs/ExtendUtils.d.ts +1 -1
  45. package/lib/mjs/ExtendUtils.js +6 -6
  46. package/lib/mjs/IActionResult.d.ts +15 -2
  47. package/lib/mjs/NumberUtils.d.ts +1 -1
  48. package/lib/mjs/NumberUtils.js +9 -9
  49. package/lib/mjs/StorageUtils.js +4 -4
  50. package/lib/mjs/Utils.d.ts +4 -4
  51. package/lib/mjs/Utils.js +61 -65
  52. package/lib/mjs/index.d.ts +22 -22
  53. package/lib/mjs/index.js +22 -22
  54. package/lib/mjs/storage/WindowStorage.d.ts +1 -1
  55. package/lib/mjs/storage/WindowStorage.js +2 -2
  56. package/lib/mjs/types/ContentDisposition.d.ts +2 -2
  57. package/lib/mjs/types/ContentDisposition.js +12 -14
  58. package/lib/mjs/types/EColor.js +5 -7
  59. package/lib/mjs/types/EHistory.d.ts +3 -3
  60. package/lib/mjs/types/EHistory.js +5 -5
  61. package/lib/mjs/types/ErrorData.d.ts +1 -1
  62. package/lib/mjs/types/EventClass.js +1 -1
  63. package/package.json +61 -63
  64. package/src/ActionResult.ts +23 -23
  65. package/src/ArrayUtils.ts +164 -172
  66. package/src/ColorUtils.ts +80 -82
  67. package/src/DataTypes.ts +745 -754
  68. package/src/DateUtils.ts +266 -268
  69. package/src/DomUtils.ts +806 -831
  70. package/src/ExtendUtils.ts +191 -191
  71. package/src/IActionResult.ts +55 -40
  72. package/src/Keyboard.ts +258 -258
  73. package/src/NumberUtils.ts +135 -135
  74. package/src/StorageUtils.ts +117 -117
  75. package/src/Utils.ts +908 -930
  76. package/src/index.ts +22 -22
  77. package/src/node/Storage.ts +53 -53
  78. package/src/storage/IStorage.ts +62 -62
  79. package/src/storage/WindowStorage.ts +140 -140
  80. package/src/types/ContentDisposition.ts +59 -63
  81. package/src/types/DataError.ts +15 -15
  82. package/src/types/DelayedExecutorType.ts +15 -15
  83. package/src/types/EColor.ts +241 -248
  84. package/src/types/EHistory.ts +151 -151
  85. package/src/types/ErrorData.ts +11 -11
  86. package/src/types/EventClass.ts +220 -220
  87. package/src/types/FormData.ts +25 -25
  88. package/src/types/ParsedPath.ts +5 -5
  89. package/tsconfig.cjs.json +16 -16
  90. package/tsconfig.json +16 -16
  91. package/.eslintignore +0 -3
  92. package/.eslintrc.json +0 -29
  93. package/.prettierignore +0 -5
  94. package/.prettierrc +0 -6
@@ -1,4 +1,4 @@
1
- export type ErrorType = 'error' | 'unhandledrejection' | 'consoleWarn' | 'consoleError';
1
+ export type ErrorType = "error" | "unhandledrejection" | "consoleWarn" | "consoleError";
2
2
  export type ErrorData = {
3
3
  type: ErrorType;
4
4
  subType?: string;
@@ -85,7 +85,7 @@ export class EventClass {
85
85
  * @param options Options
86
86
  */
87
87
  on(type, callback, options) {
88
- if (typeof type === 'object') {
88
+ if (typeof type === "object") {
89
89
  for (const key in type) {
90
90
  const item = key;
91
91
  const itemCallback = type[item] ?? callback;
package/package.json CHANGED
@@ -1,67 +1,65 @@
1
1
  {
2
- "name": "@etsoo/shared",
3
- "version": "1.2.51",
4
- "description": "TypeScript shared utilities and functions",
5
- "main": "lib/cjs/index.js",
6
- "module": "lib/mjs/index.js",
7
- "types": "lib/mjs/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./lib/mjs/index.js",
11
- "require": "./lib/cjs/index.js"
12
- }
13
- },
14
- "sideEffects": false,
15
- "scripts": {
16
- "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
17
- "format": "prettier --write src/**/*.ts",
18
- "lint": "eslint --ext .ts src/",
19
- "test": "jest",
20
- "test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"
21
- },
22
- "jest": {
23
- "automock": false,
24
- "testMatch": [
25
- "<rootDir>/__tests__/**/*.ts"
26
- ],
27
- "testEnvironment": "jsdom",
28
- "moduleFileExtensions": [
29
- "js",
30
- "ts",
31
- "d.ts"
32
- ],
33
- "transform": {
34
- ".+\\.ts$": "ts-jest"
35
- }
36
- },
37
- "repository": {
38
- "type": "git",
39
- "url": "git+https://github.com/ETSOO/Shared.git"
40
- },
41
- "keywords": [
42
- "Shared utilities",
43
- "TypeScript",
44
- "ETSOO",
45
- "SmartERP",
46
- "司友云平台",
47
- "青岛亿速思维",
48
- "上海亿商"
2
+ "name": "@etsoo/shared",
3
+ "version": "1.2.54",
4
+ "description": "TypeScript shared utilities and functions",
5
+ "main": "lib/cjs/index.js",
6
+ "module": "lib/mjs/index.js",
7
+ "types": "lib/mjs/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./lib/mjs/index.js",
11
+ "require": "./lib/cjs/index.js"
12
+ }
13
+ },
14
+ "sideEffects": false,
15
+ "scripts": {
16
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
17
+ "test": "jest",
18
+ "test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"
19
+ },
20
+ "jest": {
21
+ "automock": false,
22
+ "testMatch": [
23
+ "<rootDir>/__tests__/**/*.ts"
24
+ ],
25
+ "testEnvironment": "jsdom",
26
+ "moduleFileExtensions": [
27
+ "js",
28
+ "ts",
29
+ "d.ts"
49
30
  ],
50
- "author": "Garry Xiao",
51
- "license": "MIT",
52
- "bugs": {
53
- "url": "https://github.com/ETSOO/Shared/issues"
54
- },
55
- "homepage": "https://github.com/ETSOO/Shared#readme",
56
- "devDependencies": {
57
- "@types/jest": "^29.5.13",
58
- "@types/lodash.isequal": "^4.5.8",
59
- "jest": "^29.7.0",
60
- "jest-environment-jsdom": "^29.7.0",
61
- "ts-jest": "^29.2.5",
62
- "typescript": "^5.6.3"
63
- },
64
- "dependencies": {
65
- "lodash.isequal": "^4.5.0"
31
+ "transform": {
32
+ ".+\\.ts$": "ts-jest"
66
33
  }
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/ETSOO/Shared.git"
38
+ },
39
+ "keywords": [
40
+ "Shared utilities",
41
+ "TypeScript",
42
+ "ETSOO",
43
+ "SmartERP",
44
+ "司友云平台",
45
+ "青岛亿速思维",
46
+ "上海亿商"
47
+ ],
48
+ "author": "Garry Xiao",
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/ETSOO/Shared/issues"
52
+ },
53
+ "homepage": "https://github.com/ETSOO/Shared#readme",
54
+ "devDependencies": {
55
+ "@types/jest": "^29.5.14",
56
+ "@types/lodash.isequal": "^4.5.8",
57
+ "jest": "^29.7.0",
58
+ "jest-environment-jsdom": "^29.7.0",
59
+ "ts-jest": "^29.2.5",
60
+ "typescript": "^5.6.3"
61
+ },
62
+ "dependencies": {
63
+ "lodash.isequal": "^4.5.0"
64
+ }
67
65
  }
@@ -1,31 +1,31 @@
1
- import { IActionResult } from './IActionResult';
1
+ import { IActionResult } from "./IActionResult";
2
2
 
3
3
  /**
4
4
  * Action result
5
5
  */
6
6
  export class ActionResult {
7
- /**
8
- * Create a result from error
9
- * @returns Action result interface
10
- */
11
- static create<D extends object = {}>(error: Error) {
12
- // If the error has status / statusCode
13
- const status =
14
- 'status' in error
15
- ? error.status
16
- : 'statusCode' in error
17
- ? error.statusCode
18
- : undefined;
7
+ /**
8
+ * Create a result from error
9
+ * @returns Action result interface
10
+ */
11
+ static create<D extends object = {}>(error: Error) {
12
+ // If the error has status / statusCode
13
+ const status =
14
+ "status" in error
15
+ ? error.status
16
+ : "statusCode" in error
17
+ ? error.statusCode
18
+ : undefined;
19
19
 
20
- // Result
21
- const result: IActionResult<D> = {
22
- status: typeof status === 'number' ? status : undefined,
23
- ok: false,
24
- type: error.name,
25
- title: error.message
26
- };
20
+ // Result
21
+ const result: IActionResult<D> = {
22
+ status: typeof status === "number" ? status : undefined,
23
+ ok: false,
24
+ type: error.name,
25
+ title: error.message
26
+ };
27
27
 
28
- // Return
29
- return result;
30
- }
28
+ // Return
29
+ return result;
30
+ }
31
31
  }
package/src/ArrayUtils.ts CHANGED
@@ -1,223 +1,215 @@
1
- import isEqual from 'lodash.isequal';
2
- import { DataTypes } from './DataTypes';
1
+ import isEqual from "lodash.isequal";
2
+ import { DataTypes } from "./DataTypes";
3
3
 
4
4
  declare global {
5
- interface Array<T> {
6
- /**
7
- * Items do not exist in target array or reverse match
8
- * @param target Target array
9
- * @param round A round for both matches
10
- */
11
- different(target: Array<T>, round?: boolean): Array<T>;
12
-
13
- /**
14
- * Get max number item or number item property
15
- * @param field Object field to calculate
16
- */
17
- max(
18
- ...field: T extends number
19
- ? [undefined?]
20
- : T extends object
21
- ? [DataTypes.Keys<T, number>]
22
- : [never]
23
- ): number;
24
-
25
- /**
26
- * Get max field value item
27
- * @param field Object field to calculate
28
- */
29
- maxItem(
30
- field: T extends object ? DataTypes.Keys<T, number> : never
31
- ): T | undefined;
32
-
33
- /**
34
- * Get min number item or number item property
35
- * @param field Object field to calculate
36
- */
37
- min(
38
- ...field: T extends number
39
- ? [undefined?]
40
- : T extends object
41
- ? [DataTypes.Keys<T, number>]
42
- : [never]
43
- ): number;
44
-
45
- /**
46
- * Get min field value item
47
- * @param field Object field to calculate
48
- */
49
- minItem(
50
- field: T extends object ? DataTypes.Keys<T, number> : never
51
- ): T | undefined;
52
-
53
- /**
54
- * Remove items by value or condition
55
- * @param items Items to remove
56
- */
57
- remove(
58
- ...items: (
59
- | (T & (DataTypes.Basic | object))
60
- | ((item: T) => boolean)
61
- )[]
62
- ): T[];
63
-
64
- /**
65
- * Sort by property
66
- * @param property Property
67
- * @param values Property values
68
- */
69
- sortByProperty<P extends keyof T>(property: P, values: T[P][]): T[];
70
-
71
- /**
72
- * Sum number items or number item properties
73
- * @param field Object field to calculate
74
- */
75
- sum(
76
- ...field: T extends number
77
- ? [undefined?]
78
- : T extends object
79
- ? [DataTypes.Keys<T, number>]
80
- : [never]
81
- ): number;
82
-
83
- /**
84
- * Make all items are unique
85
- * @param this Input array
86
- */
87
- toUnique(): Array<T>;
88
- }
5
+ interface Array<T> {
6
+ /**
7
+ * Items do not exist in target array or reverse match
8
+ * @param target Target array
9
+ * @param round A round for both matches
10
+ */
11
+ different(target: Array<T>, round?: boolean): Array<T>;
12
+
13
+ /**
14
+ * Get max number item or number item property
15
+ * @param field Object field to calculate
16
+ */
17
+ max(
18
+ ...field: T extends number
19
+ ? [undefined?]
20
+ : T extends object
21
+ ? [DataTypes.Keys<T, number>]
22
+ : [never]
23
+ ): number;
24
+
25
+ /**
26
+ * Get max field value item
27
+ * @param field Object field to calculate
28
+ */
29
+ maxItem(
30
+ field: T extends object ? DataTypes.Keys<T, number> : never
31
+ ): T | undefined;
32
+
33
+ /**
34
+ * Get min number item or number item property
35
+ * @param field Object field to calculate
36
+ */
37
+ min(
38
+ ...field: T extends number
39
+ ? [undefined?]
40
+ : T extends object
41
+ ? [DataTypes.Keys<T, number>]
42
+ : [never]
43
+ ): number;
44
+
45
+ /**
46
+ * Get min field value item
47
+ * @param field Object field to calculate
48
+ */
49
+ minItem(
50
+ field: T extends object ? DataTypes.Keys<T, number> : never
51
+ ): T | undefined;
52
+
53
+ /**
54
+ * Remove items by value or condition
55
+ * @param items Items to remove
56
+ */
57
+ remove(
58
+ ...items: ((T & (DataTypes.Basic | object)) | ((item: T) => boolean))[]
59
+ ): T[];
60
+
61
+ /**
62
+ * Sort by property
63
+ * @param property Property
64
+ * @param values Property values
65
+ */
66
+ sortByProperty<P extends keyof T>(property: P, values: T[P][]): T[];
67
+
68
+ /**
69
+ * Sum number items or number item properties
70
+ * @param field Object field to calculate
71
+ */
72
+ sum(
73
+ ...field: T extends number
74
+ ? [undefined?]
75
+ : T extends object
76
+ ? [DataTypes.Keys<T, number>]
77
+ : [never]
78
+ ): number;
79
+
80
+ /**
81
+ * Make all items are unique
82
+ * @param this Input array
83
+ */
84
+ toUnique(): Array<T>;
85
+ }
89
86
  }
90
87
 
91
88
  Array.prototype.different = function <T>(
92
- this: Array<T>,
93
- target: Array<T>,
94
- round?: boolean
89
+ this: Array<T>,
90
+ target: Array<T>,
91
+ round?: boolean
95
92
  ) {
96
- return ArrayUtils.differences(this, target, round);
93
+ return ArrayUtils.differences(this, target, round);
97
94
  };
98
95
 
99
96
  Array.prototype.toUnique = function <T>(this: Array<T>) {
100
- if (this.length === 0 || typeof this[0] !== 'object')
101
- return Array.from(new Set(this));
102
-
103
- const newArray: T[] = [];
104
- this.forEach((item) => {
105
- if (newArray.some((newItem) => isEqual(item, newItem))) return;
106
- newArray.push(item);
107
- });
108
- return newArray;
97
+ if (this.length === 0 || typeof this[0] !== "object")
98
+ return Array.from(new Set(this));
99
+
100
+ const newArray: T[] = [];
101
+ this.forEach((item) => {
102
+ if (newArray.some((newItem) => isEqual(item, newItem))) return;
103
+ newArray.push(item);
104
+ });
105
+ return newArray;
109
106
  };
110
107
 
111
108
  Array.prototype.max = function <T>(
112
- this: Array<T>,
113
- field: T extends object ? DataTypes.Keys<T, number> : undefined
109
+ this: Array<T>,
110
+ field: T extends object ? DataTypes.Keys<T, number> : undefined
114
111
  ) {
115
- if (field == null) {
116
- return Math.max(...(this as Array<number>));
117
- }
112
+ if (field == null) {
113
+ return Math.max(...(this as Array<number>));
114
+ }
118
115
 
119
- return Math.max(...this.map((item) => item[field] as number));
116
+ return Math.max(...this.map((item) => item[field] as number));
120
117
  };
121
118
 
122
119
  Array.prototype.maxItem = function <T>(
123
- this: Array<T>,
124
- field: T extends object ? DataTypes.Keys<T, number> : never
120
+ this: Array<T>,
121
+ field: T extends object ? DataTypes.Keys<T, number> : never
125
122
  ) {
126
- if (this.length === 0) return undefined;
123
+ if (this.length === 0) return undefined;
127
124
 
128
- return this.reduce((prev, curr) =>
129
- prev[field] > curr[field] ? prev : curr
130
- );
125
+ return this.reduce((prev, curr) => (prev[field] > curr[field] ? prev : curr));
131
126
  };
132
127
 
133
128
  Array.prototype.min = function <T>(
134
- this: Array<T>,
135
- field: T extends object ? DataTypes.Keys<T, number> : undefined
129
+ this: Array<T>,
130
+ field: T extends object ? DataTypes.Keys<T, number> : undefined
136
131
  ) {
137
- if (field == null) {
138
- return Math.min(...(this as Array<number>));
139
- }
132
+ if (field == null) {
133
+ return Math.min(...(this as Array<number>));
134
+ }
140
135
 
141
- return Math.min(...this.map((item) => item[field] as number));
136
+ return Math.min(...this.map((item) => item[field] as number));
142
137
  };
143
138
 
144
139
  Array.prototype.minItem = function <T>(
145
- this: Array<T>,
146
- field: T extends object ? DataTypes.Keys<T, number> : never
140
+ this: Array<T>,
141
+ field: T extends object ? DataTypes.Keys<T, number> : never
147
142
  ) {
148
- if (this.length === 0) return undefined;
143
+ if (this.length === 0) return undefined;
149
144
 
150
- return this.reduce((prev, curr) =>
151
- prev[field] < curr[field] ? prev : curr
152
- );
145
+ return this.reduce((prev, curr) => (prev[field] < curr[field] ? prev : curr));
153
146
  };
154
147
 
155
148
  Array.prototype.remove = function <T>(
156
- this: Array<T>,
157
- ...items: ((T & (DataTypes.Basic | object)) | ((item: T) => boolean))[]
149
+ this: Array<T>,
150
+ ...items: ((T & (DataTypes.Basic | object)) | ((item: T) => boolean))[]
158
151
  ) {
159
- const funs: ((item: T) => boolean)[] = [];
160
- const results: T[] = [];
161
- items.forEach((item) => {
162
- if (typeof item === 'function') {
163
- funs.push(item);
164
- } else {
165
- // For object items, should be removed by reference, not by value
166
- const index = this.indexOf(item);
167
- if (index >= 0) results.push(...this.splice(index, 1));
168
- }
169
- });
170
-
171
- if (funs.length > 0) {
172
- // Reduce check loops for performance
173
- for (let i = this.length - 1; i >= 0; i--) {
174
- if (funs.some((fun) => fun(this[i])))
175
- results.push(...this.splice(i, 1));
176
- }
152
+ const funs: ((item: T) => boolean)[] = [];
153
+ const results: T[] = [];
154
+ items.forEach((item) => {
155
+ if (typeof item === "function") {
156
+ funs.push(item);
157
+ } else {
158
+ // For object items, should be removed by reference, not by value
159
+ const index = this.indexOf(item);
160
+ if (index >= 0) results.push(...this.splice(index, 1));
177
161
  }
162
+ });
178
163
 
179
- return results;
164
+ if (funs.length > 0) {
165
+ // Reduce check loops for performance
166
+ for (let i = this.length - 1; i >= 0; i--) {
167
+ if (funs.some((fun) => fun(this[i]))) results.push(...this.splice(i, 1));
168
+ }
169
+ }
170
+
171
+ return results;
180
172
  };
181
173
 
182
174
  Array.prototype.sortByProperty = function <T, P extends keyof T>(
183
- this: Array<T>,
184
- property: P,
185
- values: T[P][]
175
+ this: Array<T>,
176
+ property: P,
177
+ values: T[P][]
186
178
  ) {
187
- return this.sort((a, b) => {
188
- const ai = values.indexOf(a[property]);
189
- const bi = values.indexOf(b[property]);
190
-
191
- if (ai === bi) return 0;
192
- if (ai < 0 || bi < 0) return bi === 0 ? 1 : bi;
193
- return ai - bi;
194
- });
179
+ return this.sort((a, b) => {
180
+ const ai = values.indexOf(a[property]);
181
+ const bi = values.indexOf(b[property]);
182
+
183
+ if (ai === bi) return 0;
184
+ if (ai < 0 || bi < 0) return bi === 0 ? 1 : bi;
185
+ return ai - bi;
186
+ });
195
187
  };
196
188
 
197
189
  Array.prototype.sum = function <T>(
198
- this: Array<T>,
199
- field: T extends object ? DataTypes.Keys<T, number> : undefined
190
+ this: Array<T>,
191
+ field: T extends object ? DataTypes.Keys<T, number> : undefined
200
192
  ) {
201
- if (field == null) {
202
- return this.reduce((total, num) => total + (num as number), 0);
203
- }
193
+ if (field == null) {
194
+ return this.reduce((total, num) => total + (num as number), 0);
195
+ }
204
196
 
205
- return this.reduce((total, item) => total + (item[field] as number), 0);
197
+ return this.reduce((total, item) => total + (item[field] as number), 0);
206
198
  };
207
199
 
208
200
  /**
209
201
  * Array Utilities
210
202
  */
211
203
  export namespace ArrayUtils {
212
- /**
213
- * Array 1 items do not exist in Array 2 or reverse match
214
- * @param a1 Array 1
215
- * @param a2 Array 2
216
- * @param round A round for both matches
217
- */
218
- export function differences<T>(a1: T[], a2: T[], round?: boolean) {
219
- const diff = a1.filter((x) => !a2.includes(x));
220
- if (round) return [...diff, ...a2.filter((x) => !a1.includes(x))];
221
- return diff;
222
- }
204
+ /**
205
+ * Array 1 items do not exist in Array 2 or reverse match
206
+ * @param a1 Array 1
207
+ * @param a2 Array 2
208
+ * @param round A round for both matches
209
+ */
210
+ export function differences<T>(a1: T[], a2: T[], round?: boolean) {
211
+ const diff = a1.filter((x) => !a2.includes(x));
212
+ if (round) return [...diff, ...a2.filter((x) => !a1.includes(x))];
213
+ return diff;
214
+ }
223
215
  }