zmdms-utils 0.0.24 → 0.0.25

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/es/common.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { __assign } from './_virtual/_tslib.js';
1
2
  import mitt from './node_modules/mitt/dist/mitt.js';
2
3
 
3
- // 基础函数
4
4
  /**
5
5
  * 同步阻断
6
6
  * @param time 秒
@@ -210,5 +210,20 @@ function isImageExtension(extension) {
210
210
  function isNonEmpty(number) {
211
211
  return number !== null && number !== undefined;
212
212
  }
213
+ /**
214
+ * 遍历一个对象,将值是数组的项,用逗号拼接起来
215
+ */
216
+ function parseJoin(params) {
217
+ if (params) {
218
+ var newParams = __assign({}, params);
219
+ for (var key in newParams) {
220
+ if (Array.isArray(newParams[key])) {
221
+ newParams[key] = newParams[key].join(",");
222
+ }
223
+ }
224
+ return newParams;
225
+ }
226
+ return params;
227
+ }
213
228
 
214
- export { addThousedSeparator, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isImageExtension, isNonEmpty, parseQueryParams, specialString, unescapeString };
229
+ export { addThousedSeparator, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString };
@@ -145,14 +145,14 @@ function parseByResult(option) {
145
145
  if (parseType === "string") {
146
146
  var dayjsValue = dayjs.isDayjs(value) ? value : dayjs(value);
147
147
  if (parseEndType === "startOf") {
148
- return dayjsValue
149
- .startOf("day")
150
- .format(parseFormat.length === 10 ? "".concat(parseFormat, " HH:mm:ss") : parseFormat);
148
+ return dayjsValue.startOf("day").format(
149
+ // parseFormat.length === 10 ? `${parseFormat} HH:mm:ss` : parseFormat
150
+ parseFormat);
151
151
  }
152
152
  if (parseEndType === "endOf") {
153
- return dayjsValue
154
- .endOf("day")
155
- .format(parseFormat.length === 10 ? "".concat(parseFormat, " HH:mm:ss") : parseFormat);
153
+ return dayjsValue.endOf("day").format(
154
+ // parseFormat.length === 10 ? `${parseFormat} HH:mm:ss` : parseFormat
155
+ parseFormat);
156
156
  }
157
157
  return dayjsValue.format(parseFormat);
158
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-utils",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/common.ts CHANGED
@@ -220,3 +220,19 @@ export function isImageExtension(extension: string): boolean {
220
220
  export function isNonEmpty(number: any) {
221
221
  return number !== null && number !== undefined;
222
222
  }
223
+
224
+ /**
225
+ * 遍历一个对象,将值是数组的项,用逗号拼接起来
226
+ */
227
+ export function parseJoin(params?: any) {
228
+ if (params) {
229
+ let newParams: any = { ...params };
230
+ for (let key in newParams) {
231
+ if (Array.isArray(newParams[key])) {
232
+ newParams[key] = newParams[key].join(",");
233
+ }
234
+ }
235
+ return newParams;
236
+ }
237
+ return params;
238
+ }
package/src/parseTime.ts CHANGED
@@ -184,18 +184,16 @@ function parseByResult(option: IProps) {
184
184
  if (parseType === "string") {
185
185
  const dayjsValue = dayjs.isDayjs(value) ? value : dayjs(value);
186
186
  if (parseEndType === "startOf") {
187
- return dayjsValue
188
- .startOf("day")
189
- .format(
190
- parseFormat.length === 10 ? `${parseFormat} HH:mm:ss` : parseFormat
191
- );
187
+ return dayjsValue.startOf("day").format(
188
+ // parseFormat.length === 10 ? `${parseFormat} HH:mm:ss` : parseFormat
189
+ parseFormat
190
+ );
192
191
  }
193
192
  if (parseEndType === "endOf") {
194
- return dayjsValue
195
- .endOf("day")
196
- .format(
197
- parseFormat.length === 10 ? `${parseFormat} HH:mm:ss` : parseFormat
198
- );
193
+ return dayjsValue.endOf("day").format(
194
+ // parseFormat.length === 10 ? `${parseFormat} HH:mm:ss` : parseFormat
195
+ parseFormat
196
+ );
199
197
  }
200
198
  return dayjsValue.format(parseFormat);
201
199
  } else {