@diffson/core 1.0.3 → 1.0.5
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/contract/constant/DiffConstants.d.ts +8 -0
- package/dist/contract/constant/DiffConstants.js +8 -0
- package/dist/contract/constant/PresetName.d.ts +6 -0
- package/dist/contract/constant/PresetName.js +7 -0
- package/dist/contract/constant/index.d.ts +2 -0
- package/dist/contract/constant/index.js +2 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +2 -0
- package/dist/contract/type/ArrayComparator.d.ts +8 -0
- package/dist/contract/type/ArrayComparator.js +2 -0
- package/dist/contract/type/ComparatorOrchestrator.d.ts +9 -0
- package/dist/contract/type/ComparatorOrchestrator.js +2 -0
- package/dist/contract/type/DiffService.d.ts +27 -0
- package/dist/contract/type/DiffService.js +2 -0
- package/dist/contract/type/JsonTypes.d.ts +5 -0
- package/dist/contract/type/JsonTypes.js +1 -0
- package/dist/contract/type/NullComparator.d.ts +6 -0
- package/dist/contract/type/NullComparator.js +2 -0
- package/dist/contract/type/ObjectComparator.d.ts +8 -0
- package/dist/contract/type/ObjectComparator.js +2 -0
- package/dist/contract/type/OtherComparator.d.ts +7 -0
- package/dist/contract/type/OtherComparator.js +2 -0
- package/dist/contract/type/PrimitiveComparator.d.ts +6 -0
- package/dist/contract/type/PrimitiveComparator.js +2 -0
- package/dist/contract/type/Result.d.ts +7 -0
- package/dist/contract/type/Result.js +7 -0
- package/dist/contract/type/SingleNodeDifference.d.ts +7 -0
- package/dist/contract/type/SingleNodeDifference.js +12 -0
- package/dist/contract/type/index.d.ts +10 -0
- package/dist/contract/type/index.js +10 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/service/comparator/ComparatorOrchestrator.d.ts +13 -0
- package/dist/service/comparator/ComparatorOrchestrator.js +55 -0
- package/dist/service/comparator/array/AbstractArray.d.ts +11 -0
- package/dist/service/comparator/array/AbstractArray.js +40 -0
- package/dist/service/comparator/array/SequentialArrayComparator.d.ts +9 -0
- package/dist/service/comparator/array/SequentialArrayComparator.js +49 -0
- package/dist/service/comparator/array/SimilarArrayComparator.d.ts +21 -0
- package/dist/service/comparator/array/SimilarArrayComparator.js +152 -0
- package/dist/service/comparator/array/index.d.ts +3 -0
- package/dist/service/comparator/array/index.js +3 -0
- package/dist/service/comparator/index.d.ts +6 -0
- package/dist/service/comparator/index.js +6 -0
- package/dist/service/comparator/nulls/DefaultNullComparator.d.ts +6 -0
- package/dist/service/comparator/nulls/DefaultNullComparator.js +6 -0
- package/dist/service/comparator/nulls/index.d.ts +1 -0
- package/dist/service/comparator/nulls/index.js +1 -0
- package/dist/service/comparator/object/AbstractObject.d.ts +16 -0
- package/dist/service/comparator/object/AbstractObject.js +90 -0
- package/dist/service/comparator/object/LeftJoinObjectComparator.d.ts +8 -0
- package/dist/service/comparator/object/LeftJoinObjectComparator.js +25 -0
- package/dist/service/comparator/object/UnionKeyObjectComparator.d.ts +8 -0
- package/dist/service/comparator/object/UnionKeyObjectComparator.js +26 -0
- package/dist/service/comparator/object/index.d.ts +3 -0
- package/dist/service/comparator/object/index.js +3 -0
- package/dist/service/comparator/other/DefaultOtherComparator.d.ts +6 -0
- package/dist/service/comparator/other/DefaultOtherComparator.js +13 -0
- package/dist/service/comparator/other/index.d.ts +1 -0
- package/dist/service/comparator/other/index.js +1 -0
- package/dist/service/comparator/primitive/DefaultPrimitiveComparator.d.ts +6 -0
- package/dist/service/comparator/primitive/DefaultPrimitiveComparator.js +16 -0
- package/dist/service/comparator/primitive/index.d.ts +1 -0
- package/dist/service/comparator/primitive/index.js +1 -0
- package/dist/service/diff/DiffContext.d.ts +13 -0
- package/dist/service/diff/DiffContext.js +29 -0
- package/dist/service/diff/DiffService.d.ts +26 -0
- package/dist/service/diff/DiffService.js +184 -0
- package/dist/service/diff/PathTracker.d.ts +21 -0
- package/dist/service/diff/PathTracker.js +56 -0
- package/dist/service/diff/index.d.ts +1 -0
- package/dist/service/diff/index.js +1 -0
- package/dist/service/index.d.ts +2 -0
- package/dist/service/index.js +2 -0
- package/dist/util/TypeGuards.d.ts +6 -0
- package/dist/util/TypeGuards.js +32 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +1 -0
- package/package.json +6 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function isJsonObject(value) {
|
|
2
|
+
return value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function isJsonArray(value) {
|
|
5
|
+
return Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
export function isJsonPrimitive(value) {
|
|
8
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
9
|
+
}
|
|
10
|
+
export function isJsonNull(value) {
|
|
11
|
+
return value === null;
|
|
12
|
+
}
|
|
13
|
+
export function jsonElement2Str(element) {
|
|
14
|
+
if (element === undefined) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
else if (isJsonObject(element)) {
|
|
18
|
+
return "{省略对象内部字段}";
|
|
19
|
+
}
|
|
20
|
+
else if (isJsonArray(element)) {
|
|
21
|
+
return "[省略数组内部元素]";
|
|
22
|
+
}
|
|
23
|
+
else if (isJsonPrimitive(element)) {
|
|
24
|
+
return String(element);
|
|
25
|
+
}
|
|
26
|
+
else if (isJsonNull(element)) {
|
|
27
|
+
return "null";
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new Error("异常");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TypeGuards";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TypeGuards";
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diffson/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist",
|
|
8
|
+
"dist/**/*.js",
|
|
9
|
+
"dist/**/*.d.ts",
|
|
10
|
+
"!dist/**/*.map",
|
|
9
11
|
"README.md"
|
|
10
12
|
],
|
|
11
13
|
"imports": {
|
|
@@ -34,10 +36,10 @@
|
|
|
34
36
|
"./package.json": "./package.json"
|
|
35
37
|
},
|
|
36
38
|
"scripts": {
|
|
37
|
-
"build": "tsc",
|
|
39
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc",
|
|
38
40
|
"test": "bun --conditions=@diffson/source test",
|
|
39
41
|
"typecheck": "tsc --noEmit",
|
|
40
|
-
"clean": "rm -rf dist node_modules"
|
|
42
|
+
"clean": "rm -rf dist node_modules tsconfig.tsbuildinfo"
|
|
41
43
|
},
|
|
42
44
|
"dependencies": {
|
|
43
45
|
"@wendellhu/redi": "latest",
|