zmdms-utils 0.0.22 → 0.0.23

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.
@@ -39,8 +39,10 @@ function parseTime(config) {
39
39
  index: index,
40
40
  endType: endTypeItem,
41
41
  });
42
- // 删除原有key
43
- Reflect.deleteProperty(newParams_1, fromKey);
42
+ if (fromKey !== toKey) {
43
+ // 删除原有key
44
+ Reflect.deleteProperty(newParams_1, fromKey);
45
+ }
44
46
  }
45
47
  // 2. 从一个键 转成 两个键
46
48
  if (typeof fromKey === "string" && typeof toKey === "object") {
@@ -62,7 +64,9 @@ function parseTime(config) {
62
64
  index: index,
63
65
  endType: endEndType,
64
66
  });
65
- Reflect.deleteProperty(newParams_1, fromKey);
67
+ if (fromKey !== toKey1 && fromKey !== toKey2) {
68
+ Reflect.deleteProperty(newParams_1, fromKey);
69
+ }
66
70
  }
67
71
  // 3. 从两个键 转成 一个键
68
72
  if (typeof fromKey === "object" && typeof toKey === "string") {
@@ -86,8 +90,12 @@ function parseTime(config) {
86
90
  endType: endEndType,
87
91
  }),
88
92
  ];
89
- Reflect.deleteProperty(newParams_1, fromKey1);
90
- Reflect.deleteProperty(newParams_1, fromtKey2);
93
+ if (fromKey1 !== toKey) {
94
+ Reflect.deleteProperty(newParams_1, fromKey1);
95
+ }
96
+ if (fromtKey2 !== toKey) {
97
+ Reflect.deleteProperty(newParams_1, fromtKey2);
98
+ }
91
99
  }
92
100
  // 4. 从两个键 转成 两个键
93
101
  if (typeof fromKey === "object" && typeof toKey === "object") {
@@ -110,8 +118,14 @@ function parseTime(config) {
110
118
  index: index,
111
119
  endType: endEndType,
112
120
  });
113
- Reflect.deleteProperty(newParams_1, fromKey1);
114
- Reflect.deleteProperty(newParams_1, fromtKey2);
121
+ if (fromKey1 !== toKey1) {
122
+ // 删除原有key
123
+ Reflect.deleteProperty(newParams_1, fromKey1);
124
+ }
125
+ if (fromtKey2 !== toKey2) {
126
+ // 删除原有key
127
+ Reflect.deleteProperty(newParams_1, fromtKey2);
128
+ }
115
129
  }
116
130
  });
117
131
  return newParams_1;
@@ -37,8 +37,10 @@ function parseTime(config) {
37
37
  index,
38
38
  endType: endTypeItem,
39
39
  });
40
- // 删除原有key
41
- Reflect.deleteProperty(newParams, fromKey);
40
+ if (fromKey !== toKey) {
41
+ // 删除原有key
42
+ Reflect.deleteProperty(newParams, fromKey);
43
+ }
42
44
  }
43
45
  // 2. 从一个键 转成 两个键
44
46
  if (typeof fromKey === "string" && typeof toKey === "object") {
@@ -60,7 +62,9 @@ function parseTime(config) {
60
62
  index,
61
63
  endType: endEndType,
62
64
  });
63
- Reflect.deleteProperty(newParams, fromKey);
65
+ if (fromKey !== toKey1 && fromKey !== toKey2) {
66
+ Reflect.deleteProperty(newParams, fromKey);
67
+ }
64
68
  }
65
69
  // 3. 从两个键 转成 一个键
66
70
  if (typeof fromKey === "object" && typeof toKey === "string") {
@@ -84,8 +88,12 @@ function parseTime(config) {
84
88
  endType: endEndType,
85
89
  }),
86
90
  ];
87
- Reflect.deleteProperty(newParams, fromKey1);
88
- Reflect.deleteProperty(newParams, fromtKey2);
91
+ if (fromKey1 !== toKey) {
92
+ Reflect.deleteProperty(newParams, fromKey1);
93
+ }
94
+ if (fromtKey2 !== toKey) {
95
+ Reflect.deleteProperty(newParams, fromtKey2);
96
+ }
89
97
  }
90
98
  // 4. 从两个键 转成 两个键
91
99
  if (typeof fromKey === "object" && typeof toKey === "object") {
@@ -108,8 +116,14 @@ function parseTime(config) {
108
116
  index,
109
117
  endType: endEndType,
110
118
  });
111
- Reflect.deleteProperty(newParams, fromKey1);
112
- Reflect.deleteProperty(newParams, fromtKey2);
119
+ if (fromKey1 !== toKey1) {
120
+ // 删除原有key
121
+ Reflect.deleteProperty(newParams, fromKey1);
122
+ }
123
+ if (fromtKey2 !== toKey2) {
124
+ // 删除原有key
125
+ Reflect.deleteProperty(newParams, fromtKey2);
126
+ }
113
127
  }
114
128
  });
115
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-utils",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/parseTime.ts CHANGED
@@ -66,8 +66,10 @@ export default function parseTime(config: IConfig) {
66
66
  index,
67
67
  endType: endTypeItem,
68
68
  });
69
- // 删除原有key
70
- Reflect.deleteProperty(newParams, fromKey);
69
+ if (fromKey !== toKey) {
70
+ // 删除原有key
71
+ Reflect.deleteProperty(newParams, fromKey);
72
+ }
71
73
  }
72
74
  // 2. 从一个键 转成 两个键
73
75
  if (typeof fromKey === "string" && typeof toKey === "object") {
@@ -89,7 +91,9 @@ export default function parseTime(config: IConfig) {
89
91
  index,
90
92
  endType: endEndType,
91
93
  });
92
- Reflect.deleteProperty(newParams, fromKey);
94
+ if (fromKey !== toKey1 && fromKey !== toKey2) {
95
+ Reflect.deleteProperty(newParams, fromKey);
96
+ }
93
97
  }
94
98
  // 3. 从两个键 转成 一个键
95
99
  if (typeof fromKey === "object" && typeof toKey === "string") {
@@ -113,8 +117,12 @@ export default function parseTime(config: IConfig) {
113
117
  endType: endEndType,
114
118
  }),
115
119
  ];
116
- Reflect.deleteProperty(newParams, fromKey1);
117
- Reflect.deleteProperty(newParams, fromtKey2);
120
+ if (fromKey1 !== toKey) {
121
+ Reflect.deleteProperty(newParams, fromKey1);
122
+ }
123
+ if (fromtKey2 !== toKey) {
124
+ Reflect.deleteProperty(newParams, fromtKey2);
125
+ }
118
126
  }
119
127
  // 4. 从两个键 转成 两个键
120
128
  if (typeof fromKey === "object" && typeof toKey === "object") {
@@ -137,8 +145,14 @@ export default function parseTime(config: IConfig) {
137
145
  index,
138
146
  endType: endEndType,
139
147
  });
140
- Reflect.deleteProperty(newParams, fromKey1);
141
- Reflect.deleteProperty(newParams, fromtKey2);
148
+ if (fromKey1 !== toKey1) {
149
+ // 删除原有key
150
+ Reflect.deleteProperty(newParams, fromKey1);
151
+ }
152
+ if (fromtKey2 !== toKey2) {
153
+ // 删除原有key
154
+ Reflect.deleteProperty(newParams, fromtKey2);
155
+ }
142
156
  }
143
157
  });
144
158
 
@@ -35,8 +35,10 @@ function parseTime(config) {
35
35
  index,
36
36
  endType: endTypeItem,
37
37
  });
38
- // 删除原有key
39
- Reflect.deleteProperty(newParams, fromKey);
38
+ if (fromKey !== toKey) {
39
+ // 删除原有key
40
+ Reflect.deleteProperty(newParams, fromKey);
41
+ }
40
42
  }
41
43
  // 2. 从一个键 转成 两个键
42
44
  if (typeof fromKey === "string" && typeof toKey === "object") {
@@ -58,7 +60,9 @@ function parseTime(config) {
58
60
  index,
59
61
  endType: endEndType,
60
62
  });
61
- Reflect.deleteProperty(newParams, fromKey);
63
+ if (fromKey !== toKey1 && fromKey !== toKey2) {
64
+ Reflect.deleteProperty(newParams, fromKey);
65
+ }
62
66
  }
63
67
  // 3. 从两个键 转成 一个键
64
68
  if (typeof fromKey === "object" && typeof toKey === "string") {
@@ -82,8 +86,12 @@ function parseTime(config) {
82
86
  endType: endEndType,
83
87
  }),
84
88
  ];
85
- Reflect.deleteProperty(newParams, fromKey1);
86
- Reflect.deleteProperty(newParams, fromtKey2);
89
+ if (fromKey1 !== toKey) {
90
+ Reflect.deleteProperty(newParams, fromKey1);
91
+ }
92
+ if (fromtKey2 !== toKey) {
93
+ Reflect.deleteProperty(newParams, fromtKey2);
94
+ }
87
95
  }
88
96
  // 4. 从两个键 转成 两个键
89
97
  if (typeof fromKey === "object" && typeof toKey === "object") {
@@ -106,8 +114,14 @@ function parseTime(config) {
106
114
  index,
107
115
  endType: endEndType,
108
116
  });
109
- Reflect.deleteProperty(newParams, fromKey1);
110
- Reflect.deleteProperty(newParams, fromtKey2);
117
+ if (fromKey1 !== toKey1) {
118
+ // 删除原有key
119
+ Reflect.deleteProperty(newParams, fromKey1);
120
+ }
121
+ if (fromtKey2 !== toKey2) {
122
+ // 删除原有key
123
+ Reflect.deleteProperty(newParams, fromtKey2);
124
+ }
111
125
  }
112
126
  });
113
127