jinbi-utils 1.0.0-beta.1
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/.babelrc +19 -0
- package/.cz-config.js +55 -0
- package/.dockerignore +3 -0
- package/.editorconfig +12 -0
- package/.eslintignore +8 -0
- package/.eslintrc.js +54 -0
- package/Dockerfile +3 -0
- package/README.md +160 -0
- package/api-extractor.json +15 -0
- package/commitlint.config.js +3 -0
- package/dist/index.esm.js +1277 -0
- package/dist/index.esm.min.js +15 -0
- package/dist/index.umd.js +1348 -0
- package/dist/index.umd.min.js +16 -0
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +1 -0
- package/docs/assets/js/search.json +1 -0
- package/docs/globals.html +144 -0
- package/docs/index.html +147 -0
- package/docs/interfaces/file.compressimgqualitycallback.html +212 -0
- package/docs/interfaces/file.compressimgscalecallback.html +206 -0
- package/docs/interfaces/file.exportbyblobparams.html +294 -0
- package/docs/interfaces/file.filesizeobject.html +227 -0
- package/docs/interfaces/file.genexportbyblobparams.html +237 -0
- package/docs/modules/common.html +188 -0
- package/docs/modules/date.html +364 -0
- package/docs/modules/file.html +452 -0
- package/docs/modules/number.html +356 -0
- package/docs/modules/object.html +245 -0
- package/docs/modules/print.html +183 -0
- package/docs/modules/string.html +352 -0
- package/docs/modules/validate.html +389 -0
- package/jest.config.js +15 -0
- package/package.json +76 -0
- package/rollup.config.js +65 -0
- package/src/common/index.ts +323 -0
- package/src/constant/common.constant.ts +13 -0
- package/src/date/index.ts +143 -0
- package/src/file/index.ts +296 -0
- package/src/http/http.ts +79 -0
- package/src/http/httpEnums.ts +61 -0
- package/src/index.ts +10 -0
- package/src/number/index.ts +190 -0
- package/src/object/index.ts +54 -0
- package/src/print/index.ts +102 -0
- package/src/string/index.ts +111 -0
- package/src/validate/index.ts +78 -0
- package/src/wecom/wecom.ts +75 -0
- package/test/common/index.test.ts +19 -0
- package/test/date/index.test.ts +107 -0
- package/test/file/index.test.ts +104 -0
- package/test/number/index.test.ts +108 -0
- package/test/object/index.test.ts +20 -0
- package/test/string/index.test.ts +82 -0
- package/tsconfig.json +39 -0
- package/typedoc.json +9 -0
- package/types/common/index.d.ts +47 -0
- package/types/constant/common.constant.d.ts +12 -0
- package/types/date/index.d.ts +60 -0
- package/types/file/index.d.ts +96 -0
- package/types/http/http.d.ts +17 -0
- package/types/http/httpEnums.d.ts +53 -0
- package/types/index.d.ts +10 -0
- package/types/number/index.d.ts +62 -0
- package/types/object/index.d.ts +25 -0
- package/types/print/index.d.ts +11 -0
- package/types/string/index.d.ts +53 -0
- package/types/validate/index.d.ts +45 -0
- package/types/wecom/wecom.d.ts +3 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 空值处理
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatEmptyValue(value: any, defaultValue?: string): any;
|
|
5
|
+
/**
|
|
6
|
+
* 格式化手机
|
|
7
|
+
#### 使用说明
|
|
8
|
+
* ```
|
|
9
|
+
* formatPhone('18211572781') => '182 1157 2781'
|
|
10
|
+
* formatPhone('18211572781', '-') => '182-1157-2781'
|
|
11
|
+
* ```
|
|
12
|
+
* @param {string | number} phone 手机号
|
|
13
|
+
* @param {string} [separator=' '] 连接符
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatPhone(phone: string | number, separator?: string, defaultValue?: string): string | number;
|
|
16
|
+
/**
|
|
17
|
+
* 隐藏手机号
|
|
18
|
+
#### 使用说明
|
|
19
|
+
* ```
|
|
20
|
+
* formatPhoneHide('18211572781') => '182****2781'
|
|
21
|
+
* formatPhoneHide('', '-') => '-'
|
|
22
|
+
* ```
|
|
23
|
+
* @param {string | number} phone 手机号
|
|
24
|
+
* @param {string} defaultValue 没有值放回的默认值
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatPhoneHide(phone: string | number, defaultValue?: string): string | number;
|
|
27
|
+
/**
|
|
28
|
+
* 格式化银行卡 (4位一空格)
|
|
29
|
+
#### 使用说明
|
|
30
|
+
* ```
|
|
31
|
+
* formatBank('6282356862823568123') => '6282 3568 6282 3568 123'
|
|
32
|
+
* formatBank('', '-') => '-'
|
|
33
|
+
* ```
|
|
34
|
+
* @param {strubg | number} val 银行卡号
|
|
35
|
+
* @param {string} defaultValue 没有值放回的默认值
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatBank(val: string | number, defaultValue?: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* 生成26个字母列表
|
|
40
|
+
#### 使用说明
|
|
41
|
+
* ```
|
|
42
|
+
* generateEnglishLetters() => ['A', ..., 'Z'];
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function generateEnglishLetters(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* 驼峰式命名转短横线命名
|
|
48
|
+
*
|
|
49
|
+
* @export
|
|
50
|
+
* @param {*} [string='']
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
export declare function humpTurnDashed(string?: string): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* validate处理相关
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* @module Validate
|
|
5
|
+
* @preferred
|
|
6
|
+
*/
|
|
7
|
+
/** 是否是外部网址
|
|
8
|
+
* @param {string} path
|
|
9
|
+
* @returns {Boolean}
|
|
10
|
+
*/
|
|
11
|
+
export declare function isExternal(path: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 去掉前后空格
|
|
14
|
+
* @param {*} str
|
|
15
|
+
*/
|
|
16
|
+
export declare function trimVal(str: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* 校验 手机
|
|
19
|
+
* @param {*} val
|
|
20
|
+
*/
|
|
21
|
+
export declare function isMobile(val: string | number): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 校验 手机
|
|
24
|
+
* 规则: 以1为开头,总共11位数
|
|
25
|
+
* @export
|
|
26
|
+
* @param {*} val
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare function isMobileSimple(val: string | number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 校验 固定电话
|
|
32
|
+
* 规则: 必须带区号
|
|
33
|
+
* @param {*} val
|
|
34
|
+
*/
|
|
35
|
+
export declare function isTelephone(val: string | number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 校验 邮箱
|
|
38
|
+
* @param {*} val
|
|
39
|
+
*/
|
|
40
|
+
export declare function isEmail(val: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 校验 QQ
|
|
43
|
+
* @param {*} val
|
|
44
|
+
*/
|
|
45
|
+
export declare function isQQ(val: string | number): boolean;
|