j-templates 6.0.9 → 6.0.11
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/Store/Diff/diffSync.js +1 -4
- package/Store/Diff/diffTree.d.ts +1 -2
- package/Store/Diff/diffTree.js +3 -3
- package/Store/Diff/diffWorker.js +1 -2
- package/Store/Store/storeAsync.js +2 -2
- package/Store/Store/storeSync.js +2 -2
- package/Utils/json.d.ts +3 -1
- package/Utils/json.js +47 -3
- package/jTemplates.js +1 -1
- package/jTemplates.js.map +1 -1
- package/package.json +1 -1
- package/Utils/jsonDeepClone.d.ts +0 -1
- package/Utils/jsonDeepClone.js +0 -20
- package/Utils/jsonMerge.d.ts +0 -1
- package/Utils/jsonMerge.js +0 -32
package/package.json
CHANGED
package/Utils/jsonDeepClone.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function JsonDeepClone<T>(value: T): T;
|
package/Utils/jsonDeepClone.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonDeepClone = JsonDeepClone;
|
|
4
|
-
const jsonType_1 = require("./jsonType");
|
|
5
|
-
function JsonDeepClone(value) {
|
|
6
|
-
const type = (0, jsonType_1.JsonType)(value);
|
|
7
|
-
switch (type) {
|
|
8
|
-
case "array":
|
|
9
|
-
return value.map(JsonDeepClone);
|
|
10
|
-
case "object": {
|
|
11
|
-
const ret = {};
|
|
12
|
-
const keys = Object.keys(value);
|
|
13
|
-
for (let x = 0; x < keys.length; x++)
|
|
14
|
-
ret[keys[x]] = JsonDeepClone(value[keys[x]]);
|
|
15
|
-
return ret;
|
|
16
|
-
}
|
|
17
|
-
default:
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
}
|
package/Utils/jsonMerge.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function JsonMerge(source: unknown, patch: unknown): unknown;
|
package/Utils/jsonMerge.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonMerge = JsonMerge;
|
|
4
|
-
const jsonType_1 = require("./jsonType");
|
|
5
|
-
function JsonMerge(source, patch) {
|
|
6
|
-
if (patch === undefined)
|
|
7
|
-
return source;
|
|
8
|
-
const sourceType = (0, jsonType_1.JsonType)(source);
|
|
9
|
-
const patchType = (0, jsonType_1.JsonType)(patch);
|
|
10
|
-
if (sourceType !== patchType)
|
|
11
|
-
return patch;
|
|
12
|
-
switch (sourceType) {
|
|
13
|
-
case "array": {
|
|
14
|
-
const typedSource = source;
|
|
15
|
-
const typedPatch = patch;
|
|
16
|
-
return typedSource.map(function (source, index) {
|
|
17
|
-
return JsonMerge(source, typedPatch[index]);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
case "object": {
|
|
21
|
-
const typedSource = source;
|
|
22
|
-
const typedPatch = patch;
|
|
23
|
-
const sourceKeys = Object.keys(typedSource);
|
|
24
|
-
const result = {};
|
|
25
|
-
for (let x = 0; x < sourceKeys.length; x++)
|
|
26
|
-
result[sourceKeys[x]] = JsonMerge(typedSource[sourceKeys[x]], typedPatch[sourceKeys[x]]);
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
default:
|
|
30
|
-
return patch;
|
|
31
|
-
}
|
|
32
|
-
}
|