@lowdefy/helpers 4.0.0-rc.5 → 4.0.0-rc.7
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/serializer.js +51 -15
- package/package.json +2 -2
package/dist/serializer.js
CHANGED
|
@@ -46,6 +46,22 @@ const makeReplacer = (customReplacer, isoStringDates)=>(key, value)=>{
|
|
|
46
46
|
newValue[k] = dateReplacer(newValue[k]);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
+
if (newValue._r_) {
|
|
50
|
+
Object.defineProperty(newValue, '_r_', {
|
|
51
|
+
value: newValue._r_,
|
|
52
|
+
enumerable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (newValue._k_) {
|
|
58
|
+
Object.defineProperty(newValue, '_k_', {
|
|
59
|
+
value: newValue._k_,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
49
65
|
return newValue;
|
|
50
66
|
}
|
|
51
67
|
if (type.isArray(newValue)) {
|
|
@@ -60,26 +76,46 @@ const makeReplacer = (customReplacer, isoStringDates)=>(key, value)=>{
|
|
|
60
76
|
};
|
|
61
77
|
const makeReviver = (customReviver)=>(key, value)=>{
|
|
62
78
|
let newValue = value;
|
|
79
|
+
if (type.isObject(newValue)) {
|
|
80
|
+
if (newValue._r_) {
|
|
81
|
+
Object.defineProperty(newValue, '_r_', {
|
|
82
|
+
value: newValue._r_,
|
|
83
|
+
enumerable: false,
|
|
84
|
+
writable: true,
|
|
85
|
+
configurable: true
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (newValue._k_) {
|
|
89
|
+
Object.defineProperty(newValue, '_k_', {
|
|
90
|
+
value: newValue._k_,
|
|
91
|
+
enumerable: false,
|
|
92
|
+
writable: true,
|
|
93
|
+
configurable: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
63
97
|
if (customReviver) {
|
|
64
98
|
newValue = customReviver(key, value);
|
|
65
99
|
}
|
|
66
|
-
if (type.isObject(newValue)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (type.isObject(newValue) && !type.isUndefined(newValue._date)) {
|
|
72
|
-
if (type.isInt(newValue._date)) {
|
|
73
|
-
return new Date(newValue._date);
|
|
74
|
-
}
|
|
75
|
-
if (newValue._date === 'now') {
|
|
76
|
-
return newValue;
|
|
100
|
+
if (type.isObject(newValue)) {
|
|
101
|
+
if (!type.isUndefined(newValue._error)) {
|
|
102
|
+
const error = new Error(newValue._error.message);
|
|
103
|
+
error.name = newValue._error.name;
|
|
104
|
+
return error;
|
|
77
105
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
if (!type.isUndefined(newValue._date)) {
|
|
107
|
+
if (type.isInt(newValue._date)) {
|
|
108
|
+
return new Date(newValue._date);
|
|
109
|
+
}
|
|
110
|
+
if (newValue._date === 'now') {
|
|
111
|
+
return newValue;
|
|
112
|
+
}
|
|
113
|
+
const result = new Date(newValue._date);
|
|
114
|
+
if (!type.isDate(result)) {
|
|
115
|
+
return newValue;
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
81
118
|
}
|
|
82
|
-
return result;
|
|
83
119
|
}
|
|
84
120
|
return newValue;
|
|
85
121
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/helpers",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "0bbeceb0a73e7c8061d83829bb5066f08cacf094"
|
|
55
55
|
}
|