tools-min-ns 1.5.2
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 +85 -0
- package/esm/array/ArrayUtil.d.ts +109 -0
- package/esm/array/ArrayUtil.js +242 -0
- package/esm/array/TreeUtil.d.ts +151 -0
- package/esm/array/TreeUtil.js +412 -0
- package/esm/base/BaseUtil.d.ts +91 -0
- package/esm/base/BaseUtil.js +148 -0
- package/esm/browser/BrowserUtil.d.ts +57 -0
- package/esm/browser/BrowserUtil.js +337 -0
- package/esm/browser/fingerprint.d.ts +120 -0
- package/esm/browser/fingerprint.js +1469 -0
- package/esm/check/CheckUtil.d.ts +110 -0
- package/esm/check/CheckUtil.js +465 -0
- package/esm/common.d.ts +43 -0
- package/esm/common.js +44 -0
- package/esm/config.d.ts +7 -0
- package/esm/config.js +7 -0
- package/esm/cookie/CookieUtil.d.ts +56 -0
- package/esm/cookie/CookieUtil.js +12 -0
- package/esm/cookie/cookie.d.ts +2 -0
- package/esm/cookie/cookie.js +104 -0
- package/esm/date/DateUtil.d.ts +261 -0
- package/esm/date/DateUtil.js +763 -0
- package/esm/env/EnvUtil.d.ts +27 -0
- package/esm/env/EnvUtil.js +29 -0
- package/esm/env/env.d.ts +41 -0
- package/esm/env/env.js +106 -0
- package/esm/func/FunctionUtil.d.ts +77 -0
- package/esm/func/FunctionUtil.js +215 -0
- package/esm/index.d.ts +19 -0
- package/esm/index.js +19 -0
- package/esm/number/NumberUtil.d.ts +96 -0
- package/esm/number/NumberUtil.js +256 -0
- package/esm/object/ObjectUtil.d.ts +41 -0
- package/esm/object/ObjectUtil.js +158 -0
- package/esm/pwd/PasswordUtil.d.ts +33 -0
- package/esm/pwd/PasswordUtil.js +68 -0
- package/esm/pwd/crypto.d.ts +6 -0
- package/esm/pwd/crypto.js +1824 -0
- package/esm/request/RequestUtil.d.ts +52 -0
- package/esm/request/RequestUtil.js +53 -0
- package/esm/request/jsonp.d.ts +18 -0
- package/esm/request/jsonp.js +73 -0
- package/esm/request/mgop/env.d.ts +7 -0
- package/esm/request/mgop/env.js +15 -0
- package/esm/request/mgop/index.d.ts +3 -0
- package/esm/request/mgop/index.js +276 -0
- package/esm/request/mgop/responseCode.d.ts +20 -0
- package/esm/request/mgop/responseCode.js +37 -0
- package/esm/request/mgop/type.d.ts +34 -0
- package/esm/request/mgop/type.js +1 -0
- package/esm/request/uniRquest/index.d.ts +2 -0
- package/esm/request/uniRquest/index.js +66 -0
- package/esm/request/uniRquest/miniapp/index.d.ts +2 -0
- package/esm/request/uniRquest/miniapp/index.js +29 -0
- package/esm/request/uniRquest/miniapp-bytedance/index.d.ts +2 -0
- package/esm/request/uniRquest/miniapp-bytedance/index.js +41 -0
- package/esm/request/uniRquest/types.d.ts +65 -0
- package/esm/request/uniRquest/types.js +36 -0
- package/esm/request/uniRquest/utils.d.ts +9 -0
- package/esm/request/uniRquest/utils.js +69 -0
- package/esm/request/uniRquest/web/index.d.ts +2 -0
- package/esm/request/uniRquest/web/index.js +85 -0
- package/esm/request/uniRquest/wechat-miniprogram/index.d.ts +2 -0
- package/esm/request/uniRquest/wechat-miniprogram/index.js +41 -0
- package/esm/request/uniRquest/weex/index.d.ts +14 -0
- package/esm/request/uniRquest/weex/index.js +59 -0
- package/esm/storage/StorageUtil.d.ts +19 -0
- package/esm/storage/StorageUtil.js +75 -0
- package/esm/string/StringUtil.d.ts +392 -0
- package/esm/string/StringUtil.js +556 -0
- package/esm/system/SystemUtil.d.ts +46 -0
- package/esm/system/SystemUtil.js +122 -0
- package/esm/transfer/MapTransferUtil.d.ts +54 -0
- package/esm/transfer/MapTransferUtil.js +160 -0
- package/esm/transfer/TransferUtil.d.ts +98 -0
- package/esm/transfer/TransferUtil.js +323 -0
- package/esm/types.d.ts +25 -0
- package/esm/types.js +1 -0
- package/esm/url/UrlUtil.d.ts +30 -0
- package/esm/url/UrlUtil.js +85 -0
- package/lib/array/ArrayUtil.d.ts +109 -0
- package/lib/array/ArrayUtil.js +252 -0
- package/lib/array/TreeUtil.d.ts +151 -0
- package/lib/array/TreeUtil.js +422 -0
- package/lib/base/BaseUtil.d.ts +91 -0
- package/lib/base/BaseUtil.js +153 -0
- package/lib/browser/BrowserUtil.d.ts +57 -0
- package/lib/browser/BrowserUtil.js +347 -0
- package/lib/browser/fingerprint.d.ts +120 -0
- package/lib/browser/fingerprint.js +1500 -0
- package/lib/check/CheckUtil.d.ts +110 -0
- package/lib/check/CheckUtil.js +475 -0
- package/lib/common.d.ts +43 -0
- package/lib/common.js +50 -0
- package/lib/config.d.ts +7 -0
- package/lib/config.js +12 -0
- package/lib/cookie/CookieUtil.d.ts +56 -0
- package/lib/cookie/CookieUtil.js +22 -0
- package/lib/cookie/cookie.d.ts +2 -0
- package/lib/cookie/cookie.js +109 -0
- package/lib/date/DateUtil.d.ts +261 -0
- package/lib/date/DateUtil.js +773 -0
- package/lib/env/EnvUtil.d.ts +27 -0
- package/lib/env/EnvUtil.js +39 -0
- package/lib/env/env.d.ts +41 -0
- package/lib/env/env.js +112 -0
- package/lib/func/FunctionUtil.d.ts +77 -0
- package/lib/func/FunctionUtil.js +225 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.js +144 -0
- package/lib/number/NumberUtil.d.ts +96 -0
- package/lib/number/NumberUtil.js +266 -0
- package/lib/object/ObjectUtil.d.ts +41 -0
- package/lib/object/ObjectUtil.js +168 -0
- package/lib/pwd/PasswordUtil.d.ts +33 -0
- package/lib/pwd/PasswordUtil.js +78 -0
- package/lib/pwd/crypto.d.ts +6 -0
- package/lib/pwd/crypto.js +1829 -0
- package/lib/request/RequestUtil.d.ts +52 -0
- package/lib/request/RequestUtil.js +94 -0
- package/lib/request/jsonp.d.ts +18 -0
- package/lib/request/jsonp.js +80 -0
- package/lib/request/mgop/env.d.ts +7 -0
- package/lib/request/mgop/env.js +21 -0
- package/lib/request/mgop/index.d.ts +3 -0
- package/lib/request/mgop/index.js +289 -0
- package/lib/request/mgop/responseCode.d.ts +20 -0
- package/lib/request/mgop/responseCode.js +42 -0
- package/lib/request/mgop/type.d.ts +34 -0
- package/lib/request/mgop/type.js +5 -0
- package/lib/request/uniRquest/index.d.ts +2 -0
- package/lib/request/uniRquest/index.js +77 -0
- package/lib/request/uniRquest/miniapp/index.d.ts +2 -0
- package/lib/request/uniRquest/miniapp/index.js +35 -0
- package/lib/request/uniRquest/miniapp-bytedance/index.d.ts +2 -0
- package/lib/request/uniRquest/miniapp-bytedance/index.js +47 -0
- package/lib/request/uniRquest/types.d.ts +65 -0
- package/lib/request/uniRquest/types.js +42 -0
- package/lib/request/uniRquest/utils.d.ts +9 -0
- package/lib/request/uniRquest/utils.js +83 -0
- package/lib/request/uniRquest/web/index.d.ts +2 -0
- package/lib/request/uniRquest/web/index.js +91 -0
- package/lib/request/uniRquest/wechat-miniprogram/index.d.ts +2 -0
- package/lib/request/uniRquest/wechat-miniprogram/index.js +47 -0
- package/lib/request/uniRquest/weex/index.d.ts +14 -0
- package/lib/request/uniRquest/weex/index.js +65 -0
- package/lib/storage/StorageUtil.d.ts +19 -0
- package/lib/storage/StorageUtil.js +85 -0
- package/lib/string/StringUtil.d.ts +392 -0
- package/lib/string/StringUtil.js +566 -0
- package/lib/system/SystemUtil.d.ts +46 -0
- package/lib/system/SystemUtil.js +132 -0
- package/lib/transfer/MapTransferUtil.d.ts +54 -0
- package/lib/transfer/MapTransferUtil.js +165 -0
- package/lib/transfer/TransferUtil.d.ts +98 -0
- package/lib/transfer/TransferUtil.js +333 -0
- package/lib/types.d.ts +25 -0
- package/lib/types.js +5 -0
- package/lib/url/UrlUtil.d.ts +30 -0
- package/lib/url/UrlUtil.js +95 -0
- package/package.json +56 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
declare namespace StringUtil {
|
|
2
|
+
/**
|
|
3
|
+
* 判断字符串是否不为空
|
|
4
|
+
* @param {String} input 输入字符串,如'我是测试的字符串'
|
|
5
|
+
* @example
|
|
6
|
+
* isNotEmpty('我是测试的字符串'); => true
|
|
7
|
+
* isNotEmpty(''); => false
|
|
8
|
+
*/
|
|
9
|
+
const isNotEmpty: (input: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 将字符串去除空格
|
|
12
|
+
* @param {string} input 输入字符串,如'我是测 试的字符串'
|
|
13
|
+
* @returns {string} 去除空格后的字符串
|
|
14
|
+
* @example
|
|
15
|
+
* trim(' 测试字符串 '); => 测试字符串
|
|
16
|
+
* trim('我是测 试的字符串'); => 我是测试的字符串
|
|
17
|
+
*/
|
|
18
|
+
const trim: (input: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* 判断字符串是否以某个字符串开头
|
|
21
|
+
* @param {string} input 输入字符串,如' abcdefg'
|
|
22
|
+
* @param {string} prefix 输入字符串,如'ab'
|
|
23
|
+
* @example
|
|
24
|
+
* startsWith('abcdefg','ab'); => true
|
|
25
|
+
* startsWith('abcdefg','bc'); => false
|
|
26
|
+
* startsWith('abcdefg','a'); => true
|
|
27
|
+
*/
|
|
28
|
+
const startsWith: (input: string, prefix: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 判断字符串是否以某个字符串结束
|
|
31
|
+
* @param {String} input 输入字符串,如' abcdefg '
|
|
32
|
+
* @param {string} suffix 输入字符串,如'fg'
|
|
33
|
+
* @examplec
|
|
34
|
+
* endsWith('abcdefg', 'fg'); => true
|
|
35
|
+
* endsWith('abcdefg', 'ef'); => false
|
|
36
|
+
* endsWith('abcdefg', 'g'); => true
|
|
37
|
+
*/
|
|
38
|
+
const endsWith: (input: string, suffix: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 判断字符串是否包含某个字符串
|
|
41
|
+
* @param {String} input 输入字符串,如'abcdefg'
|
|
42
|
+
* @param {string} searchSeq 输入字符串,如'abc'
|
|
43
|
+
* @example
|
|
44
|
+
* contains('abcdefg', 'abc'); => true
|
|
45
|
+
* contains('abcdefg', 'gh'); => false
|
|
46
|
+
* contains('abcdefg', 'a'); => true
|
|
47
|
+
*/
|
|
48
|
+
const contains: (input: string, searchSeq: string) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 忽略大小写判断两个字符串是否相等
|
|
51
|
+
* @param {String} input1 输入字符串,如'equalsIgnoreCasE',
|
|
52
|
+
* @param {String} input2 输入字符串,如'equalsIgnoreCase'
|
|
53
|
+
* @example
|
|
54
|
+
* equalsIgnoreCase('equalsIgnoreCasE', 'equalsIgnoreCase'); => true
|
|
55
|
+
* equalsIgnoreCase('equals ', 'equalsIgnoreCase'); => false
|
|
56
|
+
*/
|
|
57
|
+
const equalsIgnoreCase: (input1: string, input2: string) => boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 判断字符串是否含有空格
|
|
60
|
+
* @param {String} input 输入字符串,如'我是 测试 的 字符串'
|
|
61
|
+
* @example
|
|
62
|
+
* containsWhitespace('我是 测试 的 字符串 '); => true
|
|
63
|
+
* containsWhitespace('我是测试的字符串'); => false
|
|
64
|
+
* containsWhitespace(' 我是测试的字符串 '); => true
|
|
65
|
+
*/
|
|
66
|
+
const containsWhitespace: (input: string) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 按指定数量生成给定字符串字符
|
|
69
|
+
* @param {string|number} ch 输入字符串,如'我是测试的字符串', 或 输入数字如 220022
|
|
70
|
+
* @param {number} repeatTimes 输入数字,如 '6'
|
|
71
|
+
* @returns {string} 指定数量的给定字符串
|
|
72
|
+
* @example
|
|
73
|
+
* repeat('AB ',6); => 'AB AB AB AB AB AB '
|
|
74
|
+
* repeat('C D',3); => 'C DC DC D'
|
|
75
|
+
* repeat('20', 3); => '202020'
|
|
76
|
+
*/
|
|
77
|
+
const repeat: (ch: string | number, repeatTimes: number) => string;
|
|
78
|
+
/**
|
|
79
|
+
* 去除字符串中的空格
|
|
80
|
+
* @param {string} input 输入字符串,如'我是 测试 的 字符串 '
|
|
81
|
+
* @returns {string} 去除空格后的字符串
|
|
82
|
+
* @example
|
|
83
|
+
* deleteWhitespace('我是 测试 的 字符串 '); => '我是测试的字符串'
|
|
84
|
+
* deleteWhitespace(''); => ''
|
|
85
|
+
*/
|
|
86
|
+
const deleteWhitespace: (input: string) => string;
|
|
87
|
+
/**
|
|
88
|
+
* 将给定字符串进行右侧填充
|
|
89
|
+
* @param {string|number} input 输入字符串
|
|
90
|
+
* @param {number} size 输入数量
|
|
91
|
+
* @param {string|number } padStr 输入填充字符
|
|
92
|
+
* @example
|
|
93
|
+
* rightPad(2222, 1, 33); => '222233'
|
|
94
|
+
* rightPad('我是测试的字符串', 2, '--'); => '我是测试的字符串----'
|
|
95
|
+
*/
|
|
96
|
+
const rightPad: (input: string | number, size: number, padStr: number | string) => string;
|
|
97
|
+
/**
|
|
98
|
+
* 将给定字符进行左侧填充
|
|
99
|
+
* @param {string|number} input 输入字符串
|
|
100
|
+
* @param {number} size 输入数量
|
|
101
|
+
* @param {string|number} padStr 输入填充字符
|
|
102
|
+
* @returns {string} 左侧填充后的字符串
|
|
103
|
+
* @example
|
|
104
|
+
* leftPad('我是测试的字符串', 2, '--'); => '----我是测试的字符串'
|
|
105
|
+
* leftPad(2222, 2, 3); => '332222'
|
|
106
|
+
*/
|
|
107
|
+
const leftPad: (input: string | number, size: number, padStr: number | string) => string;
|
|
108
|
+
/**
|
|
109
|
+
* 将字符串首字母转大写
|
|
110
|
+
* @param {string} input 输入字符串
|
|
111
|
+
* @example
|
|
112
|
+
* capitalize('admin'); => 'Admin'
|
|
113
|
+
* capitalize('capitalize'); => 'Capitalize'
|
|
114
|
+
*/
|
|
115
|
+
const capitalize: (input: string) => string;
|
|
116
|
+
/**
|
|
117
|
+
* 将字符串首字母转小写
|
|
118
|
+
* @param {string} input 输入字符串
|
|
119
|
+
* @example
|
|
120
|
+
* unCapitalize('Capitalize'); => 'capitalize'
|
|
121
|
+
* unCapitalize('SetTimeout'); => 'setTimeout'
|
|
122
|
+
*/
|
|
123
|
+
const unCapitalize: (input: string) => string;
|
|
124
|
+
/**
|
|
125
|
+
* 将字符串中的字母大写转小写,小写转大写
|
|
126
|
+
* @param {string} input 输入字符串
|
|
127
|
+
* @example
|
|
128
|
+
* swapCase('aBcde'); => 'AbCDE'
|
|
129
|
+
* swapCase('ABCDe'); => 'abcdE'
|
|
130
|
+
*/
|
|
131
|
+
const swapCase: (input: string) => string;
|
|
132
|
+
/**
|
|
133
|
+
* 统计含有的子字符串的个数
|
|
134
|
+
* @param {string} input 输入字符串
|
|
135
|
+
* @param {string} sub 输入子字符串
|
|
136
|
+
* @example
|
|
137
|
+
* countMatches('dabddadb', 'da'); => 2
|
|
138
|
+
* countMatches('abcdeabcdeabcde','ab'); => 3
|
|
139
|
+
*/
|
|
140
|
+
const countMatches: (input: string, sub: string) => number;
|
|
141
|
+
/**
|
|
142
|
+
* 判断字符串是否为字母
|
|
143
|
+
* @param {string} input 输入字符串
|
|
144
|
+
* @example
|
|
145
|
+
* isAlpha('abce测试'); => false
|
|
146
|
+
* isAlpha('abcdeabcdeabcde'); => true
|
|
147
|
+
*/
|
|
148
|
+
const isAlpha: (input: string) => boolean;
|
|
149
|
+
/**
|
|
150
|
+
* 判断字符串是否为字母、空格
|
|
151
|
+
* @param {string} input 输入字符串
|
|
152
|
+
* @example
|
|
153
|
+
* isAlphaSpace(' abc 测试 '); => false
|
|
154
|
+
* isAlphaSpace('abcd eabc deab cde'); => true
|
|
155
|
+
*/
|
|
156
|
+
const isAlphaSpace: (input: string) => boolean;
|
|
157
|
+
/**
|
|
158
|
+
* 判断字符串是否为字母、数字
|
|
159
|
+
* @param {string} input 输入字符串
|
|
160
|
+
* @example
|
|
161
|
+
* isAlphanumeric('abcd串abcd'); => false
|
|
162
|
+
* isAlphanumeric('22abcdeabcdeabcde22'); => true
|
|
163
|
+
*/
|
|
164
|
+
const isAlphanumeric: (input: string) => boolean;
|
|
165
|
+
/**
|
|
166
|
+
* 判断字符串是否为字母、数字和空格
|
|
167
|
+
* @param {string} input 输入字符串
|
|
168
|
+
* @example
|
|
169
|
+
* isAlphanumericSpace('我是测试的 222字符串'); => false
|
|
170
|
+
* isAlphanumericSpace('22abcde abcde abcde 22'); => true
|
|
171
|
+
*/
|
|
172
|
+
const isAlphanumericSpace: (input: string) => boolean;
|
|
173
|
+
/**
|
|
174
|
+
* 判断字符串是否为数字
|
|
175
|
+
* @param {string} input 输入数字
|
|
176
|
+
* @example
|
|
177
|
+
* isNumeric('我是测试的 字符串'); => false
|
|
178
|
+
* isNumeric(220022); => true
|
|
179
|
+
*/
|
|
180
|
+
const isNumeric: (input: string) => boolean;
|
|
181
|
+
/**
|
|
182
|
+
* 判断字符串是否为小数
|
|
183
|
+
* @param {string} input 输入数字
|
|
184
|
+
* @example
|
|
185
|
+
* isDecimal('220022'); => false
|
|
186
|
+
* isDecimal(22.0022); => true
|
|
187
|
+
*/
|
|
188
|
+
const isDecimal: (input: string) => boolean;
|
|
189
|
+
/**
|
|
190
|
+
* 判断字符串是否为负小数
|
|
191
|
+
* @param {number} input 输入数字
|
|
192
|
+
* @example
|
|
193
|
+
* isNegativeDecimal('22.0022'); => false
|
|
194
|
+
* isNegativeDecimal('-22.0022'); => true
|
|
195
|
+
*/
|
|
196
|
+
const isNegativeDecimal: (input: string) => boolean;
|
|
197
|
+
/**
|
|
198
|
+
* 判断字符串是否为正小数
|
|
199
|
+
* @param {string} input 输入数字
|
|
200
|
+
* @example
|
|
201
|
+
* isPositiveDecimal('22.0022'); => true
|
|
202
|
+
* isPositiveDecimal('-22.0022'); => false
|
|
203
|
+
*/
|
|
204
|
+
const isPositiveDecimal: (input: string) => boolean;
|
|
205
|
+
/**
|
|
206
|
+
* 判断字符串是否为整数
|
|
207
|
+
* @param {string} input 输入数字
|
|
208
|
+
* @example
|
|
209
|
+
* isInteger('-220022'); => true
|
|
210
|
+
* isInteger('22.0022'); => false
|
|
211
|
+
*/
|
|
212
|
+
const isInteger: (input: string) => boolean;
|
|
213
|
+
/**
|
|
214
|
+
* 判断字符串是否为正整数
|
|
215
|
+
* @param {string} input 输入数字
|
|
216
|
+
* @example
|
|
217
|
+
* isPositiveInteger('220022'); => true
|
|
218
|
+
* isPositiveInteger('-22.22'); => false
|
|
219
|
+
*/
|
|
220
|
+
const isPositiveInteger: (input: string) => boolean;
|
|
221
|
+
/**
|
|
222
|
+
* 判断字符串是否为负整数
|
|
223
|
+
* @param {string} input 输入数字
|
|
224
|
+
* @example
|
|
225
|
+
* isNegativeInteger('-220022'); => true
|
|
226
|
+
* isNegativeInteger('22.22'); => false
|
|
227
|
+
*/
|
|
228
|
+
const isNegativeInteger: (input: string) => boolean;
|
|
229
|
+
/**
|
|
230
|
+
* 判断字符串是否为数字、空格
|
|
231
|
+
* @param {string} input 输入字符串
|
|
232
|
+
* @example
|
|
233
|
+
* isNumericSpace('2 2 0 0 2 2'); => true
|
|
234
|
+
* isNumericSpace('2222aa'); => false
|
|
235
|
+
*/
|
|
236
|
+
const isNumericSpace: (input: string) => boolean;
|
|
237
|
+
/**
|
|
238
|
+
* 判断字符串是否为空格
|
|
239
|
+
* @param {string} input 输入字符串
|
|
240
|
+
* @example
|
|
241
|
+
* isWhitespace(' '); => true
|
|
242
|
+
* isWhitespace('22.22'); => false
|
|
243
|
+
*/
|
|
244
|
+
const isWhitespace: (input: string) => boolean;
|
|
245
|
+
/**
|
|
246
|
+
* 判断字符串是否为小写字母
|
|
247
|
+
* @param {string} input 输入字符串
|
|
248
|
+
* @example
|
|
249
|
+
* isAllLowerCase('abcdefg'); => true
|
|
250
|
+
* isAllLowerCase('isAllLowerCase'); => false
|
|
251
|
+
*/
|
|
252
|
+
const isAllLowerCase: (input: string) => boolean;
|
|
253
|
+
/**
|
|
254
|
+
* 判断字符串是否为大写字母
|
|
255
|
+
* @param {string} input 输入字符串
|
|
256
|
+
* @example
|
|
257
|
+
* isAllUpperCase('ABCDEFG'); => true
|
|
258
|
+
* isAllUpperCase('isAllLowerCase'); => false
|
|
259
|
+
*/
|
|
260
|
+
const isAllUpperCase: (input: string) => boolean;
|
|
261
|
+
/**
|
|
262
|
+
* 如果字符串为空则使用默认字符串, 否则不变
|
|
263
|
+
* @param {string} input 输入字符串
|
|
264
|
+
* @param {string} defaultStr 输入字符串
|
|
265
|
+
* @example
|
|
266
|
+
* defaultIfEmpty('', 'abcd'); => 'abcd'
|
|
267
|
+
* defaultIfEmpty('我是测试的字符串isAllLowerCase', '我是测试的字符串'); => '我是测试的字符串isAllLowerCase'
|
|
268
|
+
*/
|
|
269
|
+
const defaultIfEmpty: (input: string, defaultStr: string) => string;
|
|
270
|
+
/**
|
|
271
|
+
* 字符串反转
|
|
272
|
+
* @param {string} input 输入字符串
|
|
273
|
+
* @example
|
|
274
|
+
* reverse('abcd'); => 'dcba'
|
|
275
|
+
* reverse('ABCD'); => 'DCBA'
|
|
276
|
+
*/
|
|
277
|
+
const reverse: (input: string) => string;
|
|
278
|
+
/**
|
|
279
|
+
* 删掉特殊字符(英文状态下)
|
|
280
|
+
* @param {string} input 输入字符串
|
|
281
|
+
* @example
|
|
282
|
+
* removeSpecialCharacter('remove SpecialCharacter$%%^'); => 'remove SpecialCharacter'
|
|
283
|
+
* removeSpecialCharacter('removeSpecialCharacter##*'); => 'removeSpecialCharacter'
|
|
284
|
+
*/
|
|
285
|
+
const removeSpecialCharacter: (input: string) => string;
|
|
286
|
+
/**
|
|
287
|
+
* 只包含特殊字符、数字和字母
|
|
288
|
+
* @param {string} input 输入字符串
|
|
289
|
+
* @example
|
|
290
|
+
* isSpecialCharacterAlphanumeric('2222SpecialCharacter$%%^'); => true
|
|
291
|
+
* isSpecialCharacterAlphanumeric('(字符串2222SpecialCharacter$%%^)'); => false
|
|
292
|
+
*/
|
|
293
|
+
const isSpecialCharacterAlphanumeric: (input: string) => boolean;
|
|
294
|
+
/**
|
|
295
|
+
* 中文校验
|
|
296
|
+
* @param {string} input 输入字符串
|
|
297
|
+
* @example
|
|
298
|
+
* isChinese('我是测试的字符串'); => true
|
|
299
|
+
* isChinese('我是测试的字 abc 符串'); => false
|
|
300
|
+
*/
|
|
301
|
+
const isChinese: (input: string) => boolean;
|
|
302
|
+
/**
|
|
303
|
+
* 去掉中文字符
|
|
304
|
+
* @param {string} input 输入字符串
|
|
305
|
+
* @example
|
|
306
|
+
* removeChinese('我是测试的字 abc 符串'); => abc
|
|
307
|
+
* removeChinese('测试abcd'); => abc
|
|
308
|
+
*/
|
|
309
|
+
const removeChinese: (input: string) => string;
|
|
310
|
+
/**
|
|
311
|
+
* 转义元字符
|
|
312
|
+
* @param {string} input 输入字符串
|
|
313
|
+
* @example
|
|
314
|
+
* escapeMetacharacter('\'\''); => '\'\''
|
|
315
|
+
* escapeMetacharacter('\n\\?'); => '\n\\?'
|
|
316
|
+
*/
|
|
317
|
+
const escapeMetacharacter: (input: string) => string;
|
|
318
|
+
/**
|
|
319
|
+
* 转义字符串中的元字符
|
|
320
|
+
* @param {string} input 输入字符串
|
|
321
|
+
* @example
|
|
322
|
+
* escapeMetacharacterOfStr('\'\''); => '\'\''
|
|
323
|
+
* escapeMetacharacterOfStr('我是测试的字abc\n符串'); => '我是测试的字abc\n符串'
|
|
324
|
+
*/
|
|
325
|
+
const escapeMetacharacterOfStr: (input: string) => string;
|
|
326
|
+
/**
|
|
327
|
+
* 将中划线分隔形式的字符串,转换为驼峰式的字符串
|
|
328
|
+
* @param {string} input 输入字符串
|
|
329
|
+
* @example
|
|
330
|
+
* camelize('last-index-of'); => 'lastIndexOf'
|
|
331
|
+
* camelize('escape-metacharacter-of-str'); => 'escapeMetacharacterOfStr'
|
|
332
|
+
*/
|
|
333
|
+
const camelize: (input: string) => string;
|
|
334
|
+
/**
|
|
335
|
+
* 将驼峰式的字符串转换为中划线分隔形式的字符串
|
|
336
|
+
* @param {string} input 输入字符串
|
|
337
|
+
* @example
|
|
338
|
+
* hyphenate('lastIndexOf'); => 'last-index-of'
|
|
339
|
+
* hyphenate('escapeMetacharacterOfStr'); => 'escape-metacharacter-of-str'
|
|
340
|
+
*/
|
|
341
|
+
const hyphenate: (input: string) => string;
|
|
342
|
+
/**
|
|
343
|
+
* 将下划线分隔形式的字符串转换为驼峰式的字符串
|
|
344
|
+
* @param {string} input 输入字符串
|
|
345
|
+
* @example
|
|
346
|
+
* camelize('last_index_of'); => 'lastIndexOf'
|
|
347
|
+
* camelize('escape_metacharacter_of_str'); => 'escapeMetacharacterOfStr'
|
|
348
|
+
*/
|
|
349
|
+
const uncamelize: (input: string) => string;
|
|
350
|
+
/**
|
|
351
|
+
* 将驼峰式的字符串转换为下划线分隔形式的字符串
|
|
352
|
+
* @param {string} input 输入字符串
|
|
353
|
+
* @example
|
|
354
|
+
* hyphenate('lastIndexOf'); => 'last_index_of'
|
|
355
|
+
* hyphenate('escapeMetacharacterOfStr'); => 'escape_metacharacter_of_str'
|
|
356
|
+
*/
|
|
357
|
+
const unhyphenate: (input: string) => string;
|
|
358
|
+
/**
|
|
359
|
+
* 检测密码强度
|
|
360
|
+
* @param {string} str 密码
|
|
361
|
+
* @example
|
|
362
|
+
* checkPwd('data123') => 2
|
|
363
|
+
*/
|
|
364
|
+
const checkPwd: (str: string) => number;
|
|
365
|
+
/**
|
|
366
|
+
* html转换文本
|
|
367
|
+
* @param {string} str html代码段
|
|
368
|
+
* @example
|
|
369
|
+
* filterTag('<p>你好</p>') => 你好
|
|
370
|
+
*/
|
|
371
|
+
const filterTag: (str: string) => string;
|
|
372
|
+
/**
|
|
373
|
+
* 格式化json
|
|
374
|
+
* @param {string} str
|
|
375
|
+
* @example
|
|
376
|
+
* verifyJson('{"a":1}') => {\n\t"a": 1\n}
|
|
377
|
+
*/
|
|
378
|
+
const verifyJson: (str: string) => string;
|
|
379
|
+
/**
|
|
380
|
+
* 生成一个用不重复的ID
|
|
381
|
+
* @default 9
|
|
382
|
+
*/
|
|
383
|
+
function getUuiD(randomLength?: number): string;
|
|
384
|
+
/** 默认颜色数组 */
|
|
385
|
+
const DEFAULT_COLORS: string[];
|
|
386
|
+
/**
|
|
387
|
+
* @name 获取颜色值
|
|
388
|
+
* @param index 默认随机
|
|
389
|
+
*/
|
|
390
|
+
const getColor: (index?: number) => string;
|
|
391
|
+
}
|
|
392
|
+
export default StringUtil;
|