@etsoo/shared 1.2.54 → 1.2.56
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/__tests__/ArrayUtils.ts +126 -126
- package/__tests__/ColorUtils.ts +24 -24
- package/__tests__/ContentDisposition.ts +18 -18
- package/__tests__/DataTypes.ts +222 -204
- package/__tests__/DateUtils.ts +82 -82
- package/__tests__/DomUtils.ts +352 -352
- package/__tests__/EHistory.ts +62 -62
- package/__tests__/ExtendUtils.ts +40 -40
- package/__tests__/Keyboard.ts +14 -14
- package/__tests__/NumberUtils.ts +37 -39
- package/__tests__/StorageUtils.ts +27 -27
- package/__tests__/Utils.ts +361 -363
- package/__tests__/tsconfig.json +16 -15
- package/lib/cjs/Utils.d.ts +1 -1
- package/lib/mjs/Utils.d.ts +1 -1
- package/package.json +6 -22
- package/src/Utils.ts +6 -6
- package/tsconfig.cjs.json +1 -1
- package/tsconfig.json +3 -3
- package/vite.config.mts +11 -0
package/__tests__/tsconfig.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowJs": false,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"types": ["vitest/globals"]
|
|
17
|
+
}
|
|
17
18
|
}
|
package/lib/cjs/Utils.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ export declare namespace Utils {
|
|
|
158
158
|
* @param ignoreFields Ignore fields
|
|
159
159
|
* @returns
|
|
160
160
|
*/
|
|
161
|
-
function getDataChanges(input:
|
|
161
|
+
function getDataChanges<T extends object>(input: T, initData: object, ignoreFields?: string[]): (keyof T & string)[];
|
|
162
162
|
/**
|
|
163
163
|
* Get nested value from object
|
|
164
164
|
* @param data Data
|
package/lib/mjs/Utils.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ export declare namespace Utils {
|
|
|
158
158
|
* @param ignoreFields Ignore fields
|
|
159
159
|
* @returns
|
|
160
160
|
*/
|
|
161
|
-
function getDataChanges(input:
|
|
161
|
+
function getDataChanges<T extends object>(input: T, initData: object, ignoreFields?: string[]): (keyof T & string)[];
|
|
162
162
|
/**
|
|
163
163
|
* Get nested value from object
|
|
164
164
|
* @param data Data
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/shared",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.56",
|
|
4
4
|
"description": "TypeScript shared utilities and functions",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -14,23 +14,7 @@
|
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
|
|
17
|
-
"test": "
|
|
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"
|
|
30
|
-
],
|
|
31
|
-
"transform": {
|
|
32
|
-
".+\\.ts$": "ts-jest"
|
|
33
|
-
}
|
|
17
|
+
"test": "vitest"
|
|
34
18
|
},
|
|
35
19
|
"repository": {
|
|
36
20
|
"type": "git",
|
|
@@ -54,10 +38,10 @@
|
|
|
54
38
|
"devDependencies": {
|
|
55
39
|
"@types/jest": "^29.5.14",
|
|
56
40
|
"@types/lodash.isequal": "^4.5.8",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
41
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
42
|
+
"jsdom": "^26.0.0",
|
|
43
|
+
"typescript": "^5.7.3",
|
|
44
|
+
"vitest": "^2.1.8"
|
|
61
45
|
},
|
|
62
46
|
"dependencies": {
|
|
63
47
|
"lodash.isequal": "^4.5.0"
|
package/src/Utils.ts
CHANGED
|
@@ -403,13 +403,13 @@ export namespace Utils {
|
|
|
403
403
|
* @param ignoreFields Ignore fields
|
|
404
404
|
* @returns
|
|
405
405
|
*/
|
|
406
|
-
export function getDataChanges(
|
|
407
|
-
input:
|
|
406
|
+
export function getDataChanges<T extends object>(
|
|
407
|
+
input: T,
|
|
408
408
|
initData: object,
|
|
409
409
|
ignoreFields: string[] = ["id"]
|
|
410
|
-
): string[] {
|
|
410
|
+
): (keyof T & string)[] {
|
|
411
411
|
// Changed fields
|
|
412
|
-
const changes: string[] = [];
|
|
412
|
+
const changes: (keyof T & string)[] = [];
|
|
413
413
|
|
|
414
414
|
Object.entries(input).forEach(([key, value]) => {
|
|
415
415
|
// Ignore fields, no process
|
|
@@ -431,7 +431,7 @@ export namespace Utils {
|
|
|
431
431
|
Reflect.deleteProperty(input, key);
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
|
-
changes.push(key);
|
|
434
|
+
changes.push(key as any);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
437
|
|
|
@@ -451,7 +451,7 @@ export namespace Utils {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
// Hold the key
|
|
454
|
-
changes.push(key);
|
|
454
|
+
changes.push(key as any);
|
|
455
455
|
});
|
|
456
456
|
|
|
457
457
|
return changes;
|
package/tsconfig.cjs.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
"target": "ES2020",
|
|
5
|
-
"module": "
|
|
6
|
-
"moduleResolution": "
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
7
|
"isolatedModules": true,
|
|
8
8
|
"outDir": "./lib/mjs",
|
|
9
9
|
"noEmit": false,
|
|
10
10
|
"declaration": true,
|
|
11
11
|
"strict": true,
|
|
12
12
|
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck":
|
|
13
|
+
"skipLibCheck": false,
|
|
14
14
|
"forceConsistentCasingInFileNames": true,
|
|
15
15
|
"lib": ["dom", "dom.iterable", "esnext"]
|
|
16
16
|
},
|
package/vite.config.mts
ADDED