@base-web-kits/base-tools-ts 1.4.10 → 1.4.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-web-kits/base-tools-ts",
3
- "version": "1.4.10",
3
+ "version": "1.4.16",
4
4
  "sideEffects": false,
5
5
  "description": "Independent TS utilities package built from src/ts.",
6
6
  "keywords": [
@@ -1,3 +1,3 @@
1
- /** 根据字符串、数组和条件对象拼接 CSS 类名 */
2
- export { clsx } from 'clsx';
3
- export type { ClassValue } from 'clsx';
1
+ /** 根据字符串、数组和条件对象拼接 CSS 类名 */
2
+ export { clsx } from 'clsx';
3
+ export type { ClassValue } from 'clsx';
@@ -7,6 +7,9 @@ import advancedFormat from 'dayjs/plugin/advancedFormat.js';
7
7
  import 'dayjs/locale/zh-cn.js';
8
8
  import { zeroPad } from '../number';
9
9
 
10
+ /** Day.js 实例类型 */
11
+ export type Dayjs = dayjs.Dayjs;
12
+
10
13
  dayjs.extend(customParseFormat);
11
14
  dayjs.extend(utc);
12
15
  dayjs.extend(timezone);
@@ -14,7 +17,7 @@ dayjs.extend(relativeTime);
14
17
  dayjs.extend(advancedFormat);
15
18
  dayjs.locale('zh-cn');
16
19
 
17
- type BaseTime = number | string | Date | dayjs.Dayjs | null | undefined;
20
+ type BaseTime = number | string | Date | Dayjs | null | undefined;
18
21
 
19
22
  /**
20
23
  * 创建 dayjs 实例
@@ -128,10 +128,10 @@ function getOSSSegs(type: string, option?: Record<string, unknown> | number | st
128
128
 
129
129
  if (typeof option === 'number' || typeof option === 'string') return `${type},${option}`;
130
130
 
131
- const segs = Object.entries(option)
132
- .filter(([, v]) => v !== null && v !== undefined)
133
- .map(([k, v]) => `${k}_${v}`)
134
- .join(',');
131
+ const segs = Object.entries(option)
132
+ .filter(([, v]) => v !== null && v !== undefined && !Number.isNaN(v))
133
+ .map(([k, v]) => `${k}_${v}`)
134
+ .join(',');
135
135
 
136
136
  return segs ? `${type},${segs}` : '';
137
137
  }