Skip to content

Commit

Permalink
Feat: add some tools
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaoh committed Nov 12, 2024
1 parent c5ff7c9 commit 922c318
Show file tree
Hide file tree
Showing 723 changed files with 1,997 additions and 1,414 deletions.
4 changes: 2 additions & 2 deletions dist/File/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* getFileType('file.JPG'); // 'jpg'
* getFileType('document'); // 'unknown'
* @param str 字符串(URL 、路径或文件名)。
* @returns 文件类型(小写格式)
* @returns
* @category File-文件相关
*/
export declare function getFileType(str: string): string;
Expand All @@ -26,7 +26,7 @@ export declare function getFileType(str: string): string;
* getFileNameFromStr('https://example.com/'); // '1691830390281' (假设当前时间为 1691830390281)
* @param str 字符串(URL 、路径或文件名)。
* @param keepExt 可选。如果为 true,则返回包含文件扩展名的完整文件名,若无扩展名则使用 `.unknown`。
* @returns 文件名(带或不带扩展名)
* @returns
* @category File-文件相关
*/
export declare function getFileNameFromStr(str: string, keepExt?: boolean): string;
Expand Down
18 changes: 17 additions & 1 deletion dist/Others/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@ export declare function transferTemperature(temperature: number | string, isCels
* @category Others-业务/其他
*/
export declare function getDataStr(value: any, defaultValue?: string, prefix?: string, suffix?: string): string;
/**
* 清理对象中的空值,将 `null` 和 `undefined` 删除或替换
* @param obj 需要清理的对象
* @param replacement 替换值,默认为 `undefined`,如果传入值则替换为该值
* @returns
* @example
* clearObject({ a: 1, b: null, c: undefined, d: '', e: ' ' });
* // 返回: { a: 1 }
*
* clearObject({ a: 1, b: null, c: undefined, d: '', e: ' ' }, '');
* // 返回: { a: 1, b: '', c: '', d: '', e: '' }
* @category Others-业务/其他
*/
export declare function clearObject(obj: any, replacement?: any): {
[k: string]: any;
};
/**
* 比较两个值是否相等,支持严格模式和忽略大小写的比较。
* @example
Expand Down Expand Up @@ -363,7 +379,7 @@ export declare function getTableColumns(fields: Array<{
}>;
/**
* 播放音频
* @param input 声音类型或者音频文件路径
* @param input 声音类型或者音频路径
* @example
* playAudio('path/to/custom.mp3');
* @returns
Expand Down
2 changes: 1 addition & 1 deletion dist/Others/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/Request/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export declare function safeDecodeURI(s: string): string;
* /// { status: '', user: 'John', id: '', dep: { a: '', id: '' } }
* @param obj 查询参数对象
* @param emptyValue 可选的空值填充值,若提供则将 `null` 和 `undefined` 替换为该值
* @returns 转换后的查询参数对象
* @returns
* @category Request-请求相关
*/
export declare function transferQueryParams(obj: Record<string, any>, emptyValue?: any): Record<string, any>;
Expand Down
23 changes: 23 additions & 0 deletions dist/String/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,27 @@ export declare function rightJoin(str: string | number, length?: string | number
* @category String-字符串
*/
export declare function loadStr(str: string, params: any, emptyStr?: string): string;
/**
* 将输入字符串分割为字符串列表,基于换行符、回车符和可选的空格
* @param str 要处理的输入字符串
* @param separatorIncludesSpace 默认 false,是否将空格作为分隔符之一
* @example
* splitString("Hello world\nThis is a test\nGood luck!");
* // 返回: ["Hello world", "This is a test", "Good luck!"]
*
* splitString("Hello world\nThis is a\ntest\nGood luck!", true);
* // 返回: ["Hello", "world", "This", "is", "a", "test", "Good", "luck!"]
*
* splitString("Hello\n\n\nworld\n\n", false);
* // 返回: ["Hello", "world"]
*
* splitString("", true);
* // 返回: []
*
* splitString(" ", false);
* // 返回: []
* @returns
* @category String-字符串
*/
export declare function splitString(str: string, separatorIncludesSpace?: boolean): string[];
//# sourceMappingURL=index.d.ts.map
Loading

0 comments on commit 922c318

Please sign in to comment.