@minto-ai/tools 1.0.669 → 1.0.670
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/README.md +28 -0
- package/dist/file/extends/enum.d.ts +2 -0
- package/dist/file/is-document-file-path.d.ts +1 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -837,6 +837,32 @@ localStorage.setItem('anonymous_id', fingerprint)
|
|
|
837
837
|
- 指纹可能随浏览器升级、系统变更或渲染差异而变化,适合作为匿名用户的临时唯一标识,不建议用于强身份识别。
|
|
838
838
|
- 隐私增强模式或跨平台差异可能禁用部分特征(如 deviceMemory、Canvas),函数会自动兼容并尽可能生成可辨识的 ID。
|
|
839
839
|
|
|
840
|
+
### `getAbsoluteUrl`
|
|
841
|
+
|
|
842
|
+
> `function getAbsoluteUrl(rawUrl: string): string`
|
|
843
|
+
|
|
844
|
+
将任意格式的 URL 路径规范化为完整的绝对 URL 地址。
|
|
845
|
+
|
|
846
|
+
#### 参数
|
|
847
|
+
|
|
848
|
+
- `rawUrl (string)`: 待规范化的原始 URL 路径,支持空值、相对路径、绝对路径等格式。
|
|
849
|
+
|
|
850
|
+
#### 返回
|
|
851
|
+
|
|
852
|
+
`(string)`: 规范化后的绝对 URL 字符串,空输入返回空字符串。
|
|
853
|
+
|
|
854
|
+
#### 例子
|
|
855
|
+
|
|
856
|
+
```typescript
|
|
857
|
+
import { getAbsoluteUrl } from '@minto-ai/tools'
|
|
858
|
+
|
|
859
|
+
// 假设当前页面 URL 为 https://example.com/page
|
|
860
|
+
|
|
861
|
+
getAbsoluteUrl('/api/data') // 'https://example.com/api/data'
|
|
862
|
+
getAbsoluteUrl('https://other.com/api') // 'https://other.com/api'
|
|
863
|
+
getAbsoluteUrl('') // ''
|
|
864
|
+
```
|
|
865
|
+
|
|
840
866
|
## 工具
|
|
841
867
|
|
|
842
868
|
### `getUuid`
|
|
@@ -898,6 +924,7 @@ await timeDelay(300)
|
|
|
898
924
|
| `PPTX` | `pptx` | PowerPoint 演示文稿 (XML 格式) |
|
|
899
925
|
| `XLS` | `xls` | Excel 工作簿 |
|
|
900
926
|
| `XLSX` | `xlsx` | Excel 工作簿 (XML 格式) |
|
|
927
|
+
| `JSON` | `json` | JSON 数据文件 |
|
|
901
928
|
| `JPG` | `jpg` | JPEG 图像 |
|
|
902
929
|
| `PNG` | `png` | PNG 图像 |
|
|
903
930
|
| `JPEG` | `jpeg` | JPEG 图像 (另一种扩展名) |
|
|
@@ -955,6 +982,7 @@ await timeDelay(300)
|
|
|
955
982
|
| `TXT` | `txt` | 文本文件 |
|
|
956
983
|
| `XLS` | `xls` | Excel 工作簿 |
|
|
957
984
|
| `XLSX` | `xlsx` | Excel 工作簿 (XML 格式) |
|
|
985
|
+
| `JSON` | `json` | JSON 数据文件 |
|
|
958
986
|
|
|
959
987
|
#### `MusicFileSuffixEnum`
|
|
960
988
|
|
|
@@ -21,6 +21,7 @@ declare const FileSuffixEnum: {
|
|
|
21
21
|
readonly MP3: "mp3";
|
|
22
22
|
readonly WAV: "wav";
|
|
23
23
|
readonly TXT: "txt";
|
|
24
|
+
readonly JSON: "json";
|
|
24
25
|
readonly ZIP: "zip";
|
|
25
26
|
readonly RAR: "rar";
|
|
26
27
|
readonly HTML: "html";
|
|
@@ -61,6 +62,7 @@ declare const DocumentFileSuffixEnum: {
|
|
|
61
62
|
readonly TXT: "txt";
|
|
62
63
|
readonly XLS: "xls";
|
|
63
64
|
readonly XLSX: "xlsx";
|
|
65
|
+
readonly JSON: "json";
|
|
64
66
|
};
|
|
65
67
|
/**
|
|
66
68
|
* 音乐文件后缀类型枚举
|
package/dist/index.js
CHANGED
|
@@ -13968,6 +13968,7 @@ var FileSuffixEnum = {
|
|
|
13968
13968
|
MP3: "mp3",
|
|
13969
13969
|
WAV: "wav",
|
|
13970
13970
|
TXT: "txt",
|
|
13971
|
+
JSON: "json",
|
|
13971
13972
|
ZIP: "zip",
|
|
13972
13973
|
RAR: "rar",
|
|
13973
13974
|
HTML: "html"
|
|
@@ -13995,7 +13996,8 @@ var DocumentFileSuffixEnum = {
|
|
|
13995
13996
|
PDF: FileSuffixEnum.PDF,
|
|
13996
13997
|
TXT: FileSuffixEnum.TXT,
|
|
13997
13998
|
XLS: FileSuffixEnum.XLS,
|
|
13998
|
-
XLSX: FileSuffixEnum.XLSX
|
|
13999
|
+
XLSX: FileSuffixEnum.XLSX,
|
|
14000
|
+
JSON: FileSuffixEnum.JSON
|
|
13999
14001
|
};
|
|
14000
14002
|
var MusicFileSuffixEnum = {
|
|
14001
14003
|
MP3: FileSuffixEnum.MP3,
|