minutool 1.0.4 → 1.0.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.
- package/dist/index.d.ts +18 -2
- package/dist/minutool.js +183 -176
- package/dist/minutool.js.map +1 -1
- package/dist/minutool.umd.cjs +3 -3
- package/dist/minutool.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -158,11 +158,13 @@ export declare const BLOCK_TAGS: string[];
|
|
|
158
158
|
export declare const buildHtmlHidden: (maps: Record<string, any>) => string;
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* 构建 CSS
|
|
161
|
+
* 构建 CSS 变量对象
|
|
162
162
|
* @param {Record<string, number|string|undefined>} vars - CSS 变量对象
|
|
163
163
|
* @returns {Record<string, string>} 返回格式化后的 CSS 变量对象
|
|
164
164
|
* @example
|
|
165
|
-
* buildStyleVars({width:
|
|
165
|
+
* buildStyleVars({width: '100px', color: 'red', text:'"hello"'})
|
|
166
|
+
* 输出 // {'--width': '100px', '--color': 'red', '--text': '"hello"'}
|
|
167
|
+
* 实际样式:style="--width: 100px; --color: red; --text: \"hello\";"
|
|
166
168
|
*/
|
|
167
169
|
export declare const buildStyleVars: (vars: Record<string, number | string | undefined>) => Record<string, string>;
|
|
168
170
|
|
|
@@ -443,6 +445,13 @@ export declare const findOne: (selector: string | HTMLElement, parent?: Document
|
|
|
443
445
|
*/
|
|
444
446
|
export declare const fixBaseUrl: (url: string, baseUrl: string) => string;
|
|
445
447
|
|
|
448
|
+
/**
|
|
449
|
+
* 将字符串转换为浮点数
|
|
450
|
+
* @param {string} str - 要转换的字符串
|
|
451
|
+
* @param {number} [defaultVal=0] - 转换失败时的默认值
|
|
452
|
+
*/
|
|
453
|
+
export declare const floatVal: (str: string, defaultVal?: number) => number;
|
|
454
|
+
|
|
446
455
|
/**
|
|
447
456
|
* 格式化日期(以 PHP 方式格式化)
|
|
448
457
|
* @param {string} format - 格式化字符串(支持 PHP date 函数的格式)
|
|
@@ -590,6 +599,13 @@ export declare const insertStyleSheet: (styleSheetStr: string, id?: string, doc?
|
|
|
590
599
|
*/
|
|
591
600
|
export declare const isBodyInit: (value: any) => value is BodyInit;
|
|
592
601
|
|
|
602
|
+
/**
|
|
603
|
+
* 判断字符串是否包含中文字符
|
|
604
|
+
* @param {string} str - 要判断的字符串
|
|
605
|
+
* @returns {boolean} 返回是否包含中文字符
|
|
606
|
+
*/
|
|
607
|
+
export declare const isChinese: (str: string) => boolean;
|
|
608
|
+
|
|
593
609
|
/**
|
|
594
610
|
* 判断对象是否为空
|
|
595
611
|
* @param obj - 要判断的对象
|