@lowdefy/helpers 4.0.0-rc.4 → 4.0.0-rc.6

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 (2) hide show
  1. package/dist/serializer.js +48 -14
  2. package/package.json +2 -2
@@ -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)) {
@@ -63,23 +79,41 @@ const makeReviver = (customReviver)=>(key, value)=>{
63
79
  if (customReviver) {
64
80
  newValue = customReviver(key, value);
65
81
  }
66
- if (type.isObject(newValue) && !type.isUndefined(newValue._error)) {
67
- const error = new Error(newValue._error.message);
68
- error.name = newValue._error.name;
69
- return error;
70
- }
71
- if (type.isObject(newValue) && !type.isUndefined(newValue._date)) {
72
- if (type.isInt(newValue._date)) {
73
- return new Date(newValue._date);
82
+ if (type.isObject(newValue)) {
83
+ if (!type.isUndefined(newValue._error)) {
84
+ const error = new Error(newValue._error.message);
85
+ error.name = newValue._error.name;
86
+ return error;
74
87
  }
75
- if (newValue._date === 'now') {
76
- return newValue;
88
+ if (!type.isUndefined(newValue._date)) {
89
+ if (type.isInt(newValue._date)) {
90
+ return new Date(newValue._date);
91
+ }
92
+ if (newValue._date === 'now') {
93
+ return newValue;
94
+ }
95
+ const result = new Date(newValue._date);
96
+ if (!type.isDate(result)) {
97
+ return newValue;
98
+ }
99
+ return result;
77
100
  }
78
- const result = new Date(newValue._date);
79
- if (!type.isDate(result)) {
80
- return newValue;
101
+ if (newValue._r_) {
102
+ Object.defineProperty(newValue, '_r_', {
103
+ value: newValue._r_,
104
+ enumerable: false,
105
+ writable: true,
106
+ configurable: true
107
+ });
108
+ }
109
+ if (newValue._k_) {
110
+ Object.defineProperty(newValue, '_k_', {
111
+ value: newValue._k_,
112
+ enumerable: false,
113
+ writable: true,
114
+ configurable: true
115
+ });
81
116
  }
82
- return result;
83
117
  }
84
118
  return newValue;
85
119
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/helpers",
3
- "version": "4.0.0-rc.4",
3
+ "version": "4.0.0-rc.6",
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": "64ac69e424c881ee15a5333b75bd22156bd58ccb"
54
+ "gitHead": "8238145a9eb26c6f3dc48661ab6eca6e3aca4f83"
55
55
  }