@base-web-kits/base-tools-ts 0.8.6 → 0.8.8
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 +43 -32
- package/dist/day/index.d.ts +1 -1
- package/dist/index.cjs +25 -25
- package/dist/index.js +19 -19
- package/dist/string/random.d.ts +2 -2
- package/dist/url/oss/index.d.ts +36 -36
- package/dist/validator/index.d.ts +1 -1
- package/package.json +60 -59
package/README.md
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
# Base Tools
|
|
2
|
-
|
|
3
|
-
web前端团队常用工具库,包含`ts`、`web`、`react`、`vue`、`uni`模块。
|
|
4
|
-
|
|
5
|
-
**安装**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
# Base Tools
|
|
2
|
+
|
|
3
|
+
web前端团队常用工具库,包含`ts`、`web`、`react`、`vue`、`uni`模块。
|
|
4
|
+
|
|
5
|
+
**安装**
|
|
6
|
+
|
|
7
|
+
按需安装即可,模块之间不相互依赖
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
// 通用 TS 模块
|
|
11
|
+
npm i @base-web-kits/base-tools-ts
|
|
12
|
+
|
|
13
|
+
// Web 模块
|
|
14
|
+
npm i @base-web-kits/base-tools-web
|
|
15
|
+
|
|
16
|
+
// React 模块
|
|
17
|
+
npm i @base-web-kits/base-tools-react
|
|
18
|
+
|
|
19
|
+
// Vue 模块
|
|
20
|
+
npm i @base-web-kits/base-tools-vue
|
|
21
|
+
|
|
22
|
+
// Uni 模块
|
|
23
|
+
npm i @base-web-kits/base-tools-uni
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**快速使用**
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// 通用 TS 模块
|
|
30
|
+
import { toDayjs, getUrlParam, toMaskPhone } from '@base-web-kits/base-tools-ts';
|
|
31
|
+
|
|
32
|
+
// Web 模块
|
|
33
|
+
import { copyText, isPC, download, setCookie } from '@base-web-kits/base-tools-web';
|
|
34
|
+
|
|
35
|
+
// React 模块
|
|
36
|
+
import { useCountDown } from '@base-web-kits/base-tools-react';
|
|
37
|
+
|
|
38
|
+
// Vue 模块
|
|
39
|
+
import { useResizeObserver } from '@base-web-kits/base-tools-vue';
|
|
40
|
+
|
|
41
|
+
// Uni 模块
|
|
42
|
+
import { chooseMedia, toPayWx } from '@base-web-kits/base-tools-uni';
|
|
43
|
+
```
|
package/dist/day/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ type BaseTime = number | string | Date | dayjs.Dayjs | null | undefined;
|
|
|
22
22
|
* d.startOf('day').valueOf(); // 当日零点
|
|
23
23
|
* d.startOf('month').format('YYYY-MM-DD HH:mm:ss'); // 月初 "2025-12-01 00:00:00"
|
|
24
24
|
* d.endOf('month').format('YYYY-MM-DD HH:mm:ss'); // 月末 "2025-12-31 23:59:59"
|
|
25
|
-
* d.fromNow(); //
|
|
25
|
+
* d.fromNow(); // “刚刚”、“x分钟前/后”、“x小时前/后”、“x天前/后”、“x月前/后”、“x年前/后”
|
|
26
26
|
* d.isSame(t, 'day'); // 是否与t在同一天
|
|
27
27
|
* d.diff(); // 与当前时间相差的毫秒数
|
|
28
28
|
* d.diff(t); // 与t相差的毫秒数
|
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ __export(index_exports, {
|
|
|
59
59
|
bind: () => bind_default,
|
|
60
60
|
bindAll: () => bindAll_default,
|
|
61
61
|
bindKey: () => bindKey_default,
|
|
62
|
-
|
|
62
|
+
buildOSSUrl: () => buildOSSUrl,
|
|
63
63
|
camelCase: () => camelCase_default,
|
|
64
64
|
capitalize: () => capitalize_default,
|
|
65
65
|
castArray: () => castArray_default,
|
|
@@ -82,7 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
create: () => create_default,
|
|
83
83
|
createRandId: () => createRandId,
|
|
84
84
|
createTimeRandId: () => createTimeRandId,
|
|
85
|
-
|
|
85
|
+
createUUID: () => createUUID,
|
|
86
86
|
curry: () => curry_default,
|
|
87
87
|
curryRight: () => curryRight_default,
|
|
88
88
|
dayjs: () => import_dayjs.default,
|
|
@@ -147,11 +147,11 @@ __export(index_exports, {
|
|
|
147
147
|
getDateRangeBefore: () => getDateRangeBefore,
|
|
148
148
|
getFileSuffix: () => getFileSuffix,
|
|
149
149
|
getFileType: () => getFileType,
|
|
150
|
+
getOSSAudio: () => getOSSAudio,
|
|
151
|
+
getOSSHls: () => getOSSHls,
|
|
152
|
+
getOSSImg: () => getOSSImg,
|
|
153
|
+
getOSSVideo: () => getOSSVideo,
|
|
150
154
|
getObjectKeys: () => getObjectKeys,
|
|
151
|
-
getOssAudio: () => getOssAudio,
|
|
152
|
-
getOssHls: () => getOssHls,
|
|
153
|
-
getOssImg: () => getOssImg,
|
|
154
|
-
getOssVideo: () => getOssVideo,
|
|
155
155
|
getQnAudio: () => getQnAudio,
|
|
156
156
|
getQnHls: () => getQnHls,
|
|
157
157
|
getQnImg: () => getQnImg,
|
|
@@ -7935,7 +7935,7 @@ function toMaskName(name) {
|
|
|
7935
7935
|
}
|
|
7936
7936
|
|
|
7937
7937
|
// src/ts/string/random.ts
|
|
7938
|
-
function
|
|
7938
|
+
function createUUID() {
|
|
7939
7939
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
7940
7940
|
const r = Math.random() * 16 | 0, v = c === "x" ? r : r & 3 | 8;
|
|
7941
7941
|
return v.toString(16);
|
|
@@ -7999,32 +7999,32 @@ function getFileType(fileName) {
|
|
|
7999
7999
|
}
|
|
8000
8000
|
|
|
8001
8001
|
// src/ts/url/oss/index.ts
|
|
8002
|
-
function
|
|
8003
|
-
return
|
|
8002
|
+
function getOSSImg(src, option) {
|
|
8003
|
+
return buildOSSUrl(src, "image", option);
|
|
8004
8004
|
}
|
|
8005
|
-
function
|
|
8006
|
-
return
|
|
8005
|
+
function getOSSVideo(src, option) {
|
|
8006
|
+
return buildOSSUrl(src, "video", option);
|
|
8007
8007
|
}
|
|
8008
|
-
function
|
|
8009
|
-
return
|
|
8008
|
+
function getOSSAudio(src, option) {
|
|
8009
|
+
return buildOSSUrl(src, "audio", option);
|
|
8010
8010
|
}
|
|
8011
|
-
function
|
|
8012
|
-
return
|
|
8011
|
+
function getOSSHls(src, option) {
|
|
8012
|
+
return buildOSSUrl(src, "hls", option);
|
|
8013
8013
|
}
|
|
8014
|
-
function
|
|
8014
|
+
function buildOSSUrl(src, type, option) {
|
|
8015
8015
|
if (!src || !option) return src;
|
|
8016
8016
|
if (src.startsWith("blob:")) return src;
|
|
8017
8017
|
if (src.includes(".svg")) return src;
|
|
8018
8018
|
const segs = [];
|
|
8019
8019
|
for (const [k, v] of Object.entries(option)) {
|
|
8020
|
-
const seg = k === "watermark" ? getWatermark(v) :
|
|
8020
|
+
const seg = k === "watermark" ? getWatermark(v) : getOSSSegs(k, v);
|
|
8021
8021
|
if (seg) segs.push(seg);
|
|
8022
8022
|
}
|
|
8023
8023
|
if (!segs.length) return src;
|
|
8024
8024
|
const base = src.split("?")[0];
|
|
8025
8025
|
return `${base}?x-oss-process=${type}/${segs.join("/")}`;
|
|
8026
8026
|
}
|
|
8027
|
-
function
|
|
8027
|
+
function getOSSSegs(type, option) {
|
|
8028
8028
|
if (!option && option !== 0) return "";
|
|
8029
8029
|
if (option === true) return type;
|
|
8030
8030
|
if (typeof option === "number" || typeof option === "string") return `${type},${option}`;
|
|
@@ -8036,7 +8036,7 @@ function getWatermark(w) {
|
|
|
8036
8036
|
if (w.image) w.image = toBase64Url(w.image);
|
|
8037
8037
|
if (w.text) w.text = toBase64Url(w.text);
|
|
8038
8038
|
if (w.type) w.type = toBase64Url(w.type);
|
|
8039
|
-
return
|
|
8039
|
+
return getOSSSegs("watermark", w);
|
|
8040
8040
|
}
|
|
8041
8041
|
function toBase64Url(s) {
|
|
8042
8042
|
let b64 = "";
|
|
@@ -8559,7 +8559,7 @@ function isLongitude(s) {
|
|
|
8559
8559
|
bind,
|
|
8560
8560
|
bindAll,
|
|
8561
8561
|
bindKey,
|
|
8562
|
-
|
|
8562
|
+
buildOSSUrl,
|
|
8563
8563
|
camelCase,
|
|
8564
8564
|
capitalize,
|
|
8565
8565
|
castArray,
|
|
@@ -8582,7 +8582,7 @@ function isLongitude(s) {
|
|
|
8582
8582
|
create,
|
|
8583
8583
|
createRandId,
|
|
8584
8584
|
createTimeRandId,
|
|
8585
|
-
|
|
8585
|
+
createUUID,
|
|
8586
8586
|
curry,
|
|
8587
8587
|
curryRight,
|
|
8588
8588
|
dayjs,
|
|
@@ -8647,11 +8647,11 @@ function isLongitude(s) {
|
|
|
8647
8647
|
getDateRangeBefore,
|
|
8648
8648
|
getFileSuffix,
|
|
8649
8649
|
getFileType,
|
|
8650
|
+
getOSSAudio,
|
|
8651
|
+
getOSSHls,
|
|
8652
|
+
getOSSImg,
|
|
8653
|
+
getOSSVideo,
|
|
8650
8654
|
getObjectKeys,
|
|
8651
|
-
getOssAudio,
|
|
8652
|
-
getOssHls,
|
|
8653
|
-
getOssImg,
|
|
8654
|
-
getOssVideo,
|
|
8655
8655
|
getQnAudio,
|
|
8656
8656
|
getQnHls,
|
|
8657
8657
|
getQnImg,
|
package/dist/index.js
CHANGED
|
@@ -7495,7 +7495,7 @@ function toMaskName(name) {
|
|
|
7495
7495
|
}
|
|
7496
7496
|
|
|
7497
7497
|
// src/ts/string/random.ts
|
|
7498
|
-
function
|
|
7498
|
+
function createUUID() {
|
|
7499
7499
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
7500
7500
|
const r = Math.random() * 16 | 0, v = c === "x" ? r : r & 3 | 8;
|
|
7501
7501
|
return v.toString(16);
|
|
@@ -7559,32 +7559,32 @@ function getFileType(fileName) {
|
|
|
7559
7559
|
}
|
|
7560
7560
|
|
|
7561
7561
|
// src/ts/url/oss/index.ts
|
|
7562
|
-
function
|
|
7563
|
-
return
|
|
7562
|
+
function getOSSImg(src, option) {
|
|
7563
|
+
return buildOSSUrl(src, "image", option);
|
|
7564
7564
|
}
|
|
7565
|
-
function
|
|
7566
|
-
return
|
|
7565
|
+
function getOSSVideo(src, option) {
|
|
7566
|
+
return buildOSSUrl(src, "video", option);
|
|
7567
7567
|
}
|
|
7568
|
-
function
|
|
7569
|
-
return
|
|
7568
|
+
function getOSSAudio(src, option) {
|
|
7569
|
+
return buildOSSUrl(src, "audio", option);
|
|
7570
7570
|
}
|
|
7571
|
-
function
|
|
7572
|
-
return
|
|
7571
|
+
function getOSSHls(src, option) {
|
|
7572
|
+
return buildOSSUrl(src, "hls", option);
|
|
7573
7573
|
}
|
|
7574
|
-
function
|
|
7574
|
+
function buildOSSUrl(src, type, option) {
|
|
7575
7575
|
if (!src || !option) return src;
|
|
7576
7576
|
if (src.startsWith("blob:")) return src;
|
|
7577
7577
|
if (src.includes(".svg")) return src;
|
|
7578
7578
|
const segs = [];
|
|
7579
7579
|
for (const [k, v] of Object.entries(option)) {
|
|
7580
|
-
const seg = k === "watermark" ? getWatermark(v) :
|
|
7580
|
+
const seg = k === "watermark" ? getWatermark(v) : getOSSSegs(k, v);
|
|
7581
7581
|
if (seg) segs.push(seg);
|
|
7582
7582
|
}
|
|
7583
7583
|
if (!segs.length) return src;
|
|
7584
7584
|
const base = src.split("?")[0];
|
|
7585
7585
|
return `${base}?x-oss-process=${type}/${segs.join("/")}`;
|
|
7586
7586
|
}
|
|
7587
|
-
function
|
|
7587
|
+
function getOSSSegs(type, option) {
|
|
7588
7588
|
if (!option && option !== 0) return "";
|
|
7589
7589
|
if (option === true) return type;
|
|
7590
7590
|
if (typeof option === "number" || typeof option === "string") return `${type},${option}`;
|
|
@@ -7596,7 +7596,7 @@ function getWatermark(w) {
|
|
|
7596
7596
|
if (w.image) w.image = toBase64Url(w.image);
|
|
7597
7597
|
if (w.text) w.text = toBase64Url(w.text);
|
|
7598
7598
|
if (w.type) w.type = toBase64Url(w.type);
|
|
7599
|
-
return
|
|
7599
|
+
return getOSSSegs("watermark", w);
|
|
7600
7600
|
}
|
|
7601
7601
|
function toBase64Url(s) {
|
|
7602
7602
|
let b64 = "";
|
|
@@ -8118,7 +8118,7 @@ export {
|
|
|
8118
8118
|
bind_default as bind,
|
|
8119
8119
|
bindAll_default as bindAll,
|
|
8120
8120
|
bindKey_default as bindKey,
|
|
8121
|
-
|
|
8121
|
+
buildOSSUrl,
|
|
8122
8122
|
camelCase_default as camelCase,
|
|
8123
8123
|
capitalize_default as capitalize,
|
|
8124
8124
|
castArray_default as castArray,
|
|
@@ -8141,7 +8141,7 @@ export {
|
|
|
8141
8141
|
create_default as create,
|
|
8142
8142
|
createRandId,
|
|
8143
8143
|
createTimeRandId,
|
|
8144
|
-
|
|
8144
|
+
createUUID,
|
|
8145
8145
|
curry_default as curry,
|
|
8146
8146
|
curryRight_default as curryRight,
|
|
8147
8147
|
dayjs,
|
|
@@ -8206,11 +8206,11 @@ export {
|
|
|
8206
8206
|
getDateRangeBefore,
|
|
8207
8207
|
getFileSuffix,
|
|
8208
8208
|
getFileType,
|
|
8209
|
+
getOSSAudio,
|
|
8210
|
+
getOSSHls,
|
|
8211
|
+
getOSSImg,
|
|
8212
|
+
getOSSVideo,
|
|
8209
8213
|
getObjectKeys,
|
|
8210
|
-
getOssAudio,
|
|
8211
|
-
getOssHls,
|
|
8212
|
-
getOssImg,
|
|
8213
|
-
getOssVideo,
|
|
8214
8214
|
getQnAudio,
|
|
8215
8215
|
getQnHls,
|
|
8216
8216
|
getQnImg,
|
package/dist/string/random.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* 生成UUID
|
|
3
3
|
* @returns UUID字符串
|
|
4
4
|
* @example
|
|
5
|
-
* const uuid =
|
|
5
|
+
* const uuid = createUUID() // '7982fcfe-5721-4632-bede-6000885be57d'
|
|
6
6
|
*/
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function createUUID(): string;
|
|
8
8
|
/**
|
|
9
9
|
* 生成随机字符串id
|
|
10
10
|
* - 常用于生成元素标签的id (默认加上'id_'前缀, 避免小程序中数字开头的id导致查询节点信息失败)
|
package/dist/url/oss/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OSSOption, OSSAudioOption, OSSHlsOption, OSSImgOption, OSSVideoOption } from './index.d';
|
|
2
2
|
export * from './index.d';
|
|
3
3
|
/**
|
|
4
4
|
* oss图片处理
|
|
@@ -7,26 +7,26 @@ export * from './index.d';
|
|
|
7
7
|
* @param option 图片处理选项
|
|
8
8
|
* @returns 处理后的图片URL(格式: `{src}?x-oss-process=image/xx`)
|
|
9
9
|
* @example
|
|
10
|
-
* 缩放:
|
|
11
|
-
* 水印:
|
|
12
|
-
* 翻转:
|
|
13
|
-
* 裁剪:
|
|
14
|
-
* 质量:
|
|
15
|
-
* 格式转换:
|
|
16
|
-
* 获取信息:
|
|
17
|
-
* 自适应方向:
|
|
18
|
-
* 内切圆:
|
|
19
|
-
* 索引切割:
|
|
20
|
-
* 圆角:
|
|
21
|
-
* 模糊:
|
|
22
|
-
* 旋转:
|
|
23
|
-
* 渐进显示:
|
|
24
|
-
* 主色调:
|
|
25
|
-
* 亮度:
|
|
26
|
-
* 锐化:
|
|
27
|
-
* 对比度:
|
|
10
|
+
* 缩放: getOSSImg('xx.jpg', { resize: { w: 100, h: 100 } })
|
|
11
|
+
* 水印: getOSSImg('xx.jpg', { watermark: { text: '水印' } });
|
|
12
|
+
* 翻转: getOSSImg('xx.jpg', { flip: 1 });
|
|
13
|
+
* 裁剪: getOSSImg('xx.jpg', { crop: { w: 100, h: 100 } });
|
|
14
|
+
* 质量: getOSSImg('xx.jpg', { quality: { q: 80 } });
|
|
15
|
+
* 格式转换: getOSSImg('xx.jpg', { format: 'jpg' });
|
|
16
|
+
* 获取信息: getOSSImg('xx.jpg', { info: true });
|
|
17
|
+
* 自适应方向: getOSSImg('xx.jpg', { 'auto-orient': 1 });
|
|
18
|
+
* 内切圆: getOSSImg('xx.jpg', { circle: { r: 100 } });
|
|
19
|
+
* 索引切割: getOSSImg('xx.jpg', { indexcrop: { x: 100 } });
|
|
20
|
+
* 圆角: getOSSImg('xx.jpg', { 'rounded-corners': { r: 10 } });
|
|
21
|
+
* 模糊: getOSSImg('xx.jpg', { blur: { r: 10, s: 10 } });
|
|
22
|
+
* 旋转: getOSSImg('xx.jpg', { rotate: 90 });
|
|
23
|
+
* 渐进显示: getOSSImg('xx.jpg', { interlace: 1 });
|
|
24
|
+
* 主色调: getOSSImg('xx.jpg', { 'average-hue': true });
|
|
25
|
+
* 亮度: getOSSImg('xx.jpg', { bright: 10 });
|
|
26
|
+
* 锐化: getOSSImg('xx.jpg', { sharpen: 100 });
|
|
27
|
+
* 对比度: getOSSImg('xx.jpg', { contrast: 100 });
|
|
28
28
|
*/
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function getOSSImg(src: string, option: OSSImgOption): string;
|
|
30
30
|
/**
|
|
31
31
|
* oss视频处理
|
|
32
32
|
* 参考官方文档: https://help.aliyun.com/zh/oss/user-guide/audio-and-video-processing/
|
|
@@ -34,15 +34,15 @@ export declare function getOssImg(src: string, option: OssImgOption): string;
|
|
|
34
34
|
* @param option 视频处理选项
|
|
35
35
|
* @returns 处理后的URL(格式: `{src}?x-oss-process=video/xx`)
|
|
36
36
|
* @example
|
|
37
|
-
* 视频转码:
|
|
38
|
-
* 转为动图:
|
|
39
|
-
* 雪碧图:
|
|
40
|
-
* 多帧截取:
|
|
41
|
-
* 视频拼接:
|
|
42
|
-
* 信息查询:
|
|
43
|
-
* 组合操作:
|
|
37
|
+
* 视频转码: getOSSVideo('xx.mp4', { convert: { format: 'mp4' } })
|
|
38
|
+
* 转为动图: getOSSVideo('xx.mp4', { animation: { format: 'gif' } })
|
|
39
|
+
* 雪碧图: getOSSVideo('xx.mp4', { sprite: { format: 'png' } })
|
|
40
|
+
* 多帧截取: getOSSVideo('xx.mp4', { snapshots: { count: 3 } })
|
|
41
|
+
* 视频拼接: getOSSVideo('xx.mp4', { concat: { list: 'a.mp4,b.mp4' } })
|
|
42
|
+
* 信息查询: getOSSVideo('xx.mp4', { info: true })
|
|
43
|
+
* 组合操作: getOSSVideo('xx.mp4', { convert: { format: 'mp4' }, snapshots: { count: 3 } })
|
|
44
44
|
*/
|
|
45
|
-
export declare function
|
|
45
|
+
export declare function getOSSVideo(src: string, option: OSSVideoOption): string;
|
|
46
46
|
/**
|
|
47
47
|
* oss音频处理
|
|
48
48
|
* 参考官方文档: https://help.aliyun.com/zh/oss/user-guide/audio-and-video-processing/
|
|
@@ -50,11 +50,11 @@ export declare function getOssVideo(src: string, option: OssVideoOption): string
|
|
|
50
50
|
* @param option 音频处理选项
|
|
51
51
|
* @returns 处理后的URL(格式: `{src}?x-oss-process=audio/xx`)
|
|
52
52
|
* @example
|
|
53
|
-
* 音频转码:
|
|
54
|
-
* 音频拼接:
|
|
55
|
-
* 信息查询:
|
|
53
|
+
* 音频转码: getOSSAudio('xx.mp3', { 'convert': { format: 'mp3' } })
|
|
54
|
+
* 音频拼接: getOSSAudio('xx.mp3', { 'concat': { list: 'a.mp3,b.mp3' } })
|
|
55
|
+
* 信息查询: getOSSAudio('xx.mp3', { 'info': true })
|
|
56
56
|
*/
|
|
57
|
-
export declare function
|
|
57
|
+
export declare function getOSSAudio(src: string, option: OSSAudioOption): string;
|
|
58
58
|
/**
|
|
59
59
|
* oss直播处理(边转边播 HLS)
|
|
60
60
|
* 参考官方文档: https://help.aliyun.com/zh/oss/user-guide/audio-and-video-processing/
|
|
@@ -62,10 +62,10 @@ export declare function getOssAudio(src: string, option: OssAudioOption): string
|
|
|
62
62
|
* @param option HLS 选项(或布尔)
|
|
63
63
|
* @returns 处理后的URL(格式: `{src}?x-oss-process=hls/xx`)
|
|
64
64
|
* @example
|
|
65
|
-
* 生成播放列表:
|
|
66
|
-
* 配置参数:
|
|
65
|
+
* 生成播放列表: getOSSHls('xx.mp4', { 'm3u8': true })
|
|
66
|
+
* 配置参数: getOSSHls('xx.mp4', { 'm3u8': { playlist: 1, segtime: 6 } })
|
|
67
67
|
*/
|
|
68
|
-
export declare function
|
|
68
|
+
export declare function getOSSHls(src: string, option: OSSHlsOption): string;
|
|
69
69
|
/**
|
|
70
70
|
* 构造oss处理地址
|
|
71
71
|
* @param src 原始地址
|
|
@@ -73,5 +73,5 @@ export declare function getOssHls(src: string, option: OssHlsOption): string;
|
|
|
73
73
|
* @param option oss处理选项
|
|
74
74
|
* @returns 处理后的URL(格式: `{src}?x-oss-process={type}/{segs.join('/')}`)
|
|
75
75
|
*/
|
|
76
|
-
export declare function
|
|
76
|
+
export declare function buildOSSUrl(src: string, type: string, option: OSSOption): string;
|
|
77
77
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -180,7 +180,7 @@ export declare function isMilitaryId(s: string): boolean;
|
|
|
180
180
|
* @param s 银行卡号
|
|
181
181
|
* @returns 是否通过 Luhn 校验
|
|
182
182
|
* @example
|
|
183
|
-
* isBankCard('6222 0201 2345 6789') // true
|
|
183
|
+
* isBankCard('6222 0201 2345 6789') // true
|
|
184
184
|
*/
|
|
185
185
|
export declare function isBankCard(s: string): boolean;
|
|
186
186
|
/**
|
package/package.json
CHANGED
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@base-web-kits/base-tools-ts",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@base-web-kits/base-tools-ts",
|
|
3
|
+
"version": "0.8.8",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"description": "Independent TS utilities package built from src/ts.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"base-tools",
|
|
8
|
+
"ts",
|
|
9
|
+
"utilities",
|
|
10
|
+
"thin-wrapper"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./index": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.cjs",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./index.js": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.cjs",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"typesVersions": {
|
|
38
|
+
"*": {
|
|
39
|
+
"*": [
|
|
40
|
+
"./dist/*"
|
|
41
|
+
],
|
|
42
|
+
"index": [
|
|
43
|
+
"./dist/index.d.ts"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"README.md"
|
|
50
|
+
],
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"lodash-es": "^4.17.21",
|
|
53
|
+
"@types/lodash-es": "^4.17.12",
|
|
54
|
+
"bignumber.js": "^9.1.2",
|
|
55
|
+
"dayjs": "^1.11.19"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"registry": "https://registry.npmjs.org"
|
|
59
|
+
}
|
|
60
|
+
}
|