jinbi-utils 1.0.0
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 +846 -0
- package/dist/index.esm.min.js +15 -0
- package/dist/index.umd.js +886 -0
- package/dist/index.umd.min.js +16 -0
- package/docs/assets/css/main.css +2679 -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 +75 -0
- package/rollup.config.js +65 -0
- package/src/common/index.ts +285 -0
- package/src/date/index.ts +141 -0
- package/src/file/index.ts +296 -0
- package/src/http/http.ts +0 -0
- package/src/http/httpEnums.ts +62 -0
- package/src/index.ts +8 -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 +17 -0
- package/types/date/index.d.ts +60 -0
- package/types/file/index.d.ts +96 -0
- package/types/index.d.ts +8 -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 +45 -0
- package/types/validate/index.d.ts +45 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="default no-js">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<title>Validate | fe-utils</title>
|
|
7
|
+
<meta name="description" content="Documentation for fe-utils">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<link rel="stylesheet" href="../assets/css/main.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<header>
|
|
13
|
+
<div class="tsd-page-toolbar">
|
|
14
|
+
<div class="container">
|
|
15
|
+
<div class="table-wrap">
|
|
16
|
+
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
|
|
17
|
+
<div class="field">
|
|
18
|
+
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
|
19
|
+
<input id="tsd-search-field" type="text" />
|
|
20
|
+
</div>
|
|
21
|
+
<ul class="results">
|
|
22
|
+
<li class="state loading">Preparing search index...</li>
|
|
23
|
+
<li class="state failure">The search index is not available</li>
|
|
24
|
+
</ul>
|
|
25
|
+
<a href="../index.html" class="title">fe-utils</a>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="table-cell" id="tsd-widgets">
|
|
28
|
+
<div id="tsd-filter">
|
|
29
|
+
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
|
|
30
|
+
<div class="tsd-filter-group">
|
|
31
|
+
<div class="tsd-select" id="tsd-filter-visibility">
|
|
32
|
+
<span class="tsd-select-label">All</span>
|
|
33
|
+
<ul class="tsd-select-list">
|
|
34
|
+
<li data-value="public">Public</li>
|
|
35
|
+
<li data-value="protected">Public/Protected</li>
|
|
36
|
+
<li data-value="private" class="selected">All</li>
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
<input type="checkbox" id="tsd-filter-inherited" checked />
|
|
40
|
+
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
|
|
41
|
+
<input type="checkbox" id="tsd-filter-externals" checked />
|
|
42
|
+
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="tsd-page-title">
|
|
51
|
+
<div class="container">
|
|
52
|
+
<ul class="tsd-breadcrumb">
|
|
53
|
+
<li>
|
|
54
|
+
<a href="../globals.html">Globals</a>
|
|
55
|
+
</li>
|
|
56
|
+
<li>
|
|
57
|
+
<a href="validate.html">Validate</a>
|
|
58
|
+
</li>
|
|
59
|
+
</ul>
|
|
60
|
+
<h1>Module Validate</h1>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</header>
|
|
64
|
+
<div class="container container-main">
|
|
65
|
+
<div class="row">
|
|
66
|
+
<div class="col-8 col-content">
|
|
67
|
+
<section class="tsd-panel tsd-comment">
|
|
68
|
+
<div class="tsd-comment tsd-typography">
|
|
69
|
+
<div class="lead">
|
|
70
|
+
<p>validate处理相关</p>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</section>
|
|
74
|
+
<section class="tsd-panel-group tsd-index-group">
|
|
75
|
+
<h2>Index</h2>
|
|
76
|
+
<section class="tsd-panel tsd-index-panel">
|
|
77
|
+
<div class="tsd-index-content">
|
|
78
|
+
<section class="tsd-index-section ">
|
|
79
|
+
<h3>Functions</h3>
|
|
80
|
+
<ul class="tsd-index-list">
|
|
81
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#isemail" class="tsd-kind-icon">is<wbr>Email</a></li>
|
|
82
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#isexternal" class="tsd-kind-icon">is<wbr>External</a></li>
|
|
83
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#ismobile" class="tsd-kind-icon">is<wbr>Mobile</a></li>
|
|
84
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#ismobilesimple" class="tsd-kind-icon">is<wbr>Mobile<wbr>Simple</a></li>
|
|
85
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#isqq" class="tsd-kind-icon">isQQ</a></li>
|
|
86
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#istelephone" class="tsd-kind-icon">is<wbr>Telephone</a></li>
|
|
87
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="validate.html#trimval" class="tsd-kind-icon">trim<wbr>Val</a></li>
|
|
88
|
+
</ul>
|
|
89
|
+
</section>
|
|
90
|
+
</div>
|
|
91
|
+
</section>
|
|
92
|
+
</section>
|
|
93
|
+
<section class="tsd-panel-group tsd-member-group ">
|
|
94
|
+
<h2>Functions</h2>
|
|
95
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
96
|
+
<a name="isemail" class="tsd-anchor"></a>
|
|
97
|
+
<h3>is<wbr>Email</h3>
|
|
98
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
99
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>Email<span class="tsd-signature-symbol">(</span>val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
100
|
+
</ul>
|
|
101
|
+
<ul class="tsd-descriptions">
|
|
102
|
+
<li class="tsd-description">
|
|
103
|
+
<aside class="tsd-sources">
|
|
104
|
+
<ul>
|
|
105
|
+
<li>Defined in src/validate/index.ts:65</li>
|
|
106
|
+
</ul>
|
|
107
|
+
</aside>
|
|
108
|
+
<div class="tsd-comment tsd-typography">
|
|
109
|
+
<div class="lead">
|
|
110
|
+
<p>校验 邮箱</p>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
114
|
+
<ul class="tsd-parameters">
|
|
115
|
+
<li>
|
|
116
|
+
<h5>val: <span class="tsd-signature-type">string</span></h5>
|
|
117
|
+
<div class="tsd-comment tsd-typography">
|
|
118
|
+
</div>
|
|
119
|
+
</li>
|
|
120
|
+
</ul>
|
|
121
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
122
|
+
</li>
|
|
123
|
+
</ul>
|
|
124
|
+
</section>
|
|
125
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
126
|
+
<a name="isexternal" class="tsd-anchor"></a>
|
|
127
|
+
<h3>is<wbr>External</h3>
|
|
128
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
129
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>External<span class="tsd-signature-symbol">(</span>path<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
130
|
+
</ul>
|
|
131
|
+
<ul class="tsd-descriptions">
|
|
132
|
+
<li class="tsd-description">
|
|
133
|
+
<aside class="tsd-sources">
|
|
134
|
+
<ul>
|
|
135
|
+
<li>Defined in src/validate/index.ts:12</li>
|
|
136
|
+
</ul>
|
|
137
|
+
</aside>
|
|
138
|
+
<div class="tsd-comment tsd-typography">
|
|
139
|
+
<div class="lead">
|
|
140
|
+
<p>是否是外部网址</p>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
144
|
+
<ul class="tsd-parameters">
|
|
145
|
+
<li>
|
|
146
|
+
<h5>path: <span class="tsd-signature-type">string</span></h5>
|
|
147
|
+
</li>
|
|
148
|
+
</ul>
|
|
149
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
150
|
+
</li>
|
|
151
|
+
</ul>
|
|
152
|
+
</section>
|
|
153
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
154
|
+
<a name="ismobile" class="tsd-anchor"></a>
|
|
155
|
+
<h3>is<wbr>Mobile</h3>
|
|
156
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
157
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>Mobile<span class="tsd-signature-symbol">(</span>val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
158
|
+
</ul>
|
|
159
|
+
<ul class="tsd-descriptions">
|
|
160
|
+
<li class="tsd-description">
|
|
161
|
+
<aside class="tsd-sources">
|
|
162
|
+
<ul>
|
|
163
|
+
<li>Defined in src/validate/index.ts:33</li>
|
|
164
|
+
</ul>
|
|
165
|
+
</aside>
|
|
166
|
+
<div class="tsd-comment tsd-typography">
|
|
167
|
+
<div class="lead">
|
|
168
|
+
<p>校验 手机</p>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
172
|
+
<ul class="tsd-parameters">
|
|
173
|
+
<li>
|
|
174
|
+
<h5>val: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h5>
|
|
175
|
+
<div class="tsd-comment tsd-typography">
|
|
176
|
+
</div>
|
|
177
|
+
</li>
|
|
178
|
+
</ul>
|
|
179
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
180
|
+
</li>
|
|
181
|
+
</ul>
|
|
182
|
+
</section>
|
|
183
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
184
|
+
<a name="ismobilesimple" class="tsd-anchor"></a>
|
|
185
|
+
<h3>is<wbr>Mobile<wbr>Simple</h3>
|
|
186
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
187
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>Mobile<wbr>Simple<span class="tsd-signature-symbol">(</span>val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
188
|
+
</ul>
|
|
189
|
+
<ul class="tsd-descriptions">
|
|
190
|
+
<li class="tsd-description">
|
|
191
|
+
<aside class="tsd-sources">
|
|
192
|
+
<ul>
|
|
193
|
+
<li>Defined in src/validate/index.ts:45</li>
|
|
194
|
+
</ul>
|
|
195
|
+
</aside>
|
|
196
|
+
<div class="tsd-comment tsd-typography">
|
|
197
|
+
<div class="lead">
|
|
198
|
+
<p>校验 手机
|
|
199
|
+
规则: 以1为开头,总共11位数</p>
|
|
200
|
+
</div>
|
|
201
|
+
<dl class="tsd-comment-tags">
|
|
202
|
+
<dt>export</dt>
|
|
203
|
+
<dd></dd>
|
|
204
|
+
</dl>
|
|
205
|
+
</div>
|
|
206
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
207
|
+
<ul class="tsd-parameters">
|
|
208
|
+
<li>
|
|
209
|
+
<h5>val: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h5>
|
|
210
|
+
</li>
|
|
211
|
+
</ul>
|
|
212
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
213
|
+
</li>
|
|
214
|
+
</ul>
|
|
215
|
+
</section>
|
|
216
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
217
|
+
<a name="isqq" class="tsd-anchor"></a>
|
|
218
|
+
<h3>isQQ</h3>
|
|
219
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
220
|
+
<li class="tsd-signature tsd-kind-icon">isQQ<span class="tsd-signature-symbol">(</span>val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
221
|
+
</ul>
|
|
222
|
+
<ul class="tsd-descriptions">
|
|
223
|
+
<li class="tsd-description">
|
|
224
|
+
<aside class="tsd-sources">
|
|
225
|
+
<ul>
|
|
226
|
+
<li>Defined in src/validate/index.ts:75</li>
|
|
227
|
+
</ul>
|
|
228
|
+
</aside>
|
|
229
|
+
<div class="tsd-comment tsd-typography">
|
|
230
|
+
<div class="lead">
|
|
231
|
+
<p>校验 QQ</p>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
235
|
+
<ul class="tsd-parameters">
|
|
236
|
+
<li>
|
|
237
|
+
<h5>val: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h5>
|
|
238
|
+
<div class="tsd-comment tsd-typography">
|
|
239
|
+
</div>
|
|
240
|
+
</li>
|
|
241
|
+
</ul>
|
|
242
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
243
|
+
</li>
|
|
244
|
+
</ul>
|
|
245
|
+
</section>
|
|
246
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
247
|
+
<a name="istelephone" class="tsd-anchor"></a>
|
|
248
|
+
<h3>is<wbr>Telephone</h3>
|
|
249
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
250
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>Telephone<span class="tsd-signature-symbol">(</span>val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
|
|
251
|
+
</ul>
|
|
252
|
+
<ul class="tsd-descriptions">
|
|
253
|
+
<li class="tsd-description">
|
|
254
|
+
<aside class="tsd-sources">
|
|
255
|
+
<ul>
|
|
256
|
+
<li>Defined in src/validate/index.ts:56</li>
|
|
257
|
+
</ul>
|
|
258
|
+
</aside>
|
|
259
|
+
<div class="tsd-comment tsd-typography">
|
|
260
|
+
<div class="lead">
|
|
261
|
+
<p>校验 固定电话
|
|
262
|
+
规则: 必须带区号</p>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
266
|
+
<ul class="tsd-parameters">
|
|
267
|
+
<li>
|
|
268
|
+
<h5>val: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h5>
|
|
269
|
+
<div class="tsd-comment tsd-typography">
|
|
270
|
+
</div>
|
|
271
|
+
</li>
|
|
272
|
+
</ul>
|
|
273
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
|
|
274
|
+
</li>
|
|
275
|
+
</ul>
|
|
276
|
+
</section>
|
|
277
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
278
|
+
<a name="trimval" class="tsd-anchor"></a>
|
|
279
|
+
<h3>trim<wbr>Val</h3>
|
|
280
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
281
|
+
<li class="tsd-signature tsd-kind-icon">trim<wbr>Val<span class="tsd-signature-symbol">(</span>str<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
|
|
282
|
+
</ul>
|
|
283
|
+
<ul class="tsd-descriptions">
|
|
284
|
+
<li class="tsd-description">
|
|
285
|
+
<aside class="tsd-sources">
|
|
286
|
+
<ul>
|
|
287
|
+
<li>Defined in src/validate/index.ts:20</li>
|
|
288
|
+
</ul>
|
|
289
|
+
</aside>
|
|
290
|
+
<div class="tsd-comment tsd-typography">
|
|
291
|
+
<div class="lead">
|
|
292
|
+
<p>去掉前后空格</p>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
296
|
+
<ul class="tsd-parameters">
|
|
297
|
+
<li>
|
|
298
|
+
<h5>str: <span class="tsd-signature-type">string</span></h5>
|
|
299
|
+
<div class="tsd-comment tsd-typography">
|
|
300
|
+
</div>
|
|
301
|
+
</li>
|
|
302
|
+
</ul>
|
|
303
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
|
|
304
|
+
</li>
|
|
305
|
+
</ul>
|
|
306
|
+
</section>
|
|
307
|
+
</section>
|
|
308
|
+
</div>
|
|
309
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
310
|
+
<nav class="tsd-navigation primary">
|
|
311
|
+
<ul>
|
|
312
|
+
<li class="globals ">
|
|
313
|
+
<a href="../globals.html"><em>Globals</em></a>
|
|
314
|
+
</li>
|
|
315
|
+
<li class=" tsd-kind-module">
|
|
316
|
+
<a href="common.html">Common</a>
|
|
317
|
+
</li>
|
|
318
|
+
<li class=" tsd-kind-module">
|
|
319
|
+
<a href="date.html">Date</a>
|
|
320
|
+
</li>
|
|
321
|
+
<li class=" tsd-kind-module">
|
|
322
|
+
<a href="file.html">File</a>
|
|
323
|
+
</li>
|
|
324
|
+
<li class=" tsd-kind-module">
|
|
325
|
+
<a href="number.html">Number</a>
|
|
326
|
+
</li>
|
|
327
|
+
<li class=" tsd-kind-module">
|
|
328
|
+
<a href="object.html">Object</a>
|
|
329
|
+
</li>
|
|
330
|
+
<li class=" tsd-kind-module">
|
|
331
|
+
<a href="print.html">Print</a>
|
|
332
|
+
</li>
|
|
333
|
+
<li class=" tsd-kind-module">
|
|
334
|
+
<a href="string.html">String</a>
|
|
335
|
+
</li>
|
|
336
|
+
<li class="current tsd-kind-module">
|
|
337
|
+
<a href="validate.html">Validate</a>
|
|
338
|
+
</li>
|
|
339
|
+
</ul>
|
|
340
|
+
</nav>
|
|
341
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
342
|
+
<ul class="before-current">
|
|
343
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
344
|
+
<a href="validate.html#isemail" class="tsd-kind-icon">is<wbr>Email</a>
|
|
345
|
+
</li>
|
|
346
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
347
|
+
<a href="validate.html#isexternal" class="tsd-kind-icon">is<wbr>External</a>
|
|
348
|
+
</li>
|
|
349
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
350
|
+
<a href="validate.html#ismobile" class="tsd-kind-icon">is<wbr>Mobile</a>
|
|
351
|
+
</li>
|
|
352
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
353
|
+
<a href="validate.html#ismobilesimple" class="tsd-kind-icon">is<wbr>Mobile<wbr>Simple</a>
|
|
354
|
+
</li>
|
|
355
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
356
|
+
<a href="validate.html#isqq" class="tsd-kind-icon">isQQ</a>
|
|
357
|
+
</li>
|
|
358
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
359
|
+
<a href="validate.html#istelephone" class="tsd-kind-icon">is<wbr>Telephone</a>
|
|
360
|
+
</li>
|
|
361
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
362
|
+
<a href="validate.html#trimval" class="tsd-kind-icon">trim<wbr>Val</a>
|
|
363
|
+
</li>
|
|
364
|
+
</ul>
|
|
365
|
+
</nav>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
<footer class="with-border-bottom">
|
|
370
|
+
<div class="container">
|
|
371
|
+
<h2>Legend</h2>
|
|
372
|
+
<div class="tsd-legend-group">
|
|
373
|
+
<ul class="tsd-legend">
|
|
374
|
+
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
|
|
375
|
+
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
|
|
376
|
+
</ul>
|
|
377
|
+
<ul class="tsd-legend">
|
|
378
|
+
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
|
|
379
|
+
</ul>
|
|
380
|
+
</div>
|
|
381
|
+
</div>
|
|
382
|
+
</footer>
|
|
383
|
+
<div class="container tsd-generator">
|
|
384
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
|
|
385
|
+
</div>
|
|
386
|
+
<div class="overlay"></div>
|
|
387
|
+
<script src="../assets/js/main.js"></script>
|
|
388
|
+
</body>
|
|
389
|
+
</html>
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'jsdom',
|
|
3
|
+
testEnvironmentOptions: {
|
|
4
|
+
url: 'http://localhost'
|
|
5
|
+
},
|
|
6
|
+
preset: 'ts-jest',
|
|
7
|
+
rootDir: './',
|
|
8
|
+
collectCoverage: false,
|
|
9
|
+
transformIgnorePatterns: ["/node_modules/"],
|
|
10
|
+
moduleFileExtensions: ["js", "ts", "tsx"],
|
|
11
|
+
transform: {
|
|
12
|
+
'^.+\\.js$': 'babel-jest',
|
|
13
|
+
'.*\\.(ts)$': 'ts-jest',
|
|
14
|
+
},
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jinbi-utils",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.umd.min.js",
|
|
6
|
+
"module": "dist/index.esm.min.js",
|
|
7
|
+
"typings": "types/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "cross-env NODE_ENV=development rollup -w -c",
|
|
10
|
+
"build": "cross-env NODE_ENV=production rollup -c && npm run build:docs",
|
|
11
|
+
"build:docs": "typedoc",
|
|
12
|
+
"lint:fix": "eslint src/** --fix",
|
|
13
|
+
"lint": "eslint src/**",
|
|
14
|
+
"test": "jest --coverage",
|
|
15
|
+
"test:dev": "jest --watch --coverage"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"fe-utils",
|
|
19
|
+
"typescript"
|
|
20
|
+
],
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": ""
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://git"
|
|
27
|
+
},
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.9.6",
|
|
32
|
+
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
|
|
33
|
+
"@babel/preset-env": "^7.9.6",
|
|
34
|
+
"@babel/preset-typescript": "^7.10.1",
|
|
35
|
+
"@commitlint/cli": "^11.0.0",
|
|
36
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
37
|
+
"@types/jest": "^25.2.3",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^3.0.2",
|
|
39
|
+
"@typescript-eslint/parser": "^3.0.2",
|
|
40
|
+
"axios": "^0.20.0",
|
|
41
|
+
"babel-jest": "^26.0.1",
|
|
42
|
+
"babel-preset-es2015-rollup": "^3.0.0",
|
|
43
|
+
"conventional-changelog": "^3.1.23",
|
|
44
|
+
"cross-env": "^7.0.2",
|
|
45
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
46
|
+
"cz-customizable": "^6.3.0",
|
|
47
|
+
"eslint": "^7.1.0",
|
|
48
|
+
"eslint-plugin-import": "^2.22.1",
|
|
49
|
+
"husky": "^2.3.0",
|
|
50
|
+
"jest": "^26.0.1",
|
|
51
|
+
"lint-staged": "^10.4.0",
|
|
52
|
+
"rollup": "^2.10.9",
|
|
53
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
54
|
+
"rollup-plugin-cleaner": "^1.0.0",
|
|
55
|
+
"rollup-plugin-eslint": "^7.0.0",
|
|
56
|
+
"rollup-plugin-serve": "^1.0.1",
|
|
57
|
+
"rollup-plugin-terser": "^6.1.0",
|
|
58
|
+
"rollup-plugin-typescript2": "^0.27.1",
|
|
59
|
+
"ts-jest": "^26.0.0",
|
|
60
|
+
"typedoc": "^0.17.8",
|
|
61
|
+
"typedoc-plugin-external-module-name": "^4.0.3",
|
|
62
|
+
"typescript": "^3.9.3"
|
|
63
|
+
},
|
|
64
|
+
"config": {
|
|
65
|
+
"commitizen": {
|
|
66
|
+
"path": "node_modules/cz-customizable"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"husky": {
|
|
70
|
+
"hooks": {
|
|
71
|
+
"pre-commit": "exit 0",
|
|
72
|
+
"commit-msg": "exit 0"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import babel from 'rollup-plugin-babel';
|
|
2
|
+
import { eslint } from "rollup-plugin-eslint";
|
|
3
|
+
import typescript from 'rollup-plugin-typescript2';
|
|
4
|
+
import cleaner from 'rollup-plugin-cleaner';
|
|
5
|
+
import { terser } from "rollup-plugin-terser";
|
|
6
|
+
import serve from 'rollup-plugin-serve';
|
|
7
|
+
import pkg from './package.json';
|
|
8
|
+
|
|
9
|
+
// 端口
|
|
10
|
+
const PORT = 3001;
|
|
11
|
+
// 是否是生产
|
|
12
|
+
const IS_PROD = process.env.NODE_ENV === 'production';
|
|
13
|
+
|
|
14
|
+
const formats = ['umd', 'esm'];
|
|
15
|
+
const output = formats.map((format) => ({
|
|
16
|
+
file: `dist/index.${format}.js`,
|
|
17
|
+
format,
|
|
18
|
+
name: pkg.name,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
// 生成模式生成压缩文件
|
|
22
|
+
if (IS_PROD) {
|
|
23
|
+
formats.forEach((format) => {
|
|
24
|
+
output.push({
|
|
25
|
+
file: `dist/index.${format}.min.js`,
|
|
26
|
+
format,
|
|
27
|
+
name: pkg.name,
|
|
28
|
+
plugins: [terser()],
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
input: 'src/index.ts',
|
|
35
|
+
output,
|
|
36
|
+
external: [],
|
|
37
|
+
plugins: [
|
|
38
|
+
eslint({
|
|
39
|
+
fix: true,
|
|
40
|
+
exclude: 'node_modules/**'
|
|
41
|
+
}),
|
|
42
|
+
// 使用 tsconfig.json 中定义 的 declarationDir
|
|
43
|
+
typescript({
|
|
44
|
+
useTsconfigDeclarationDir: true,
|
|
45
|
+
}),
|
|
46
|
+
babel({
|
|
47
|
+
exclude: 'node_modules/**',
|
|
48
|
+
}),
|
|
49
|
+
cleaner({
|
|
50
|
+
targets: [
|
|
51
|
+
'./dist/',
|
|
52
|
+
'./types/'
|
|
53
|
+
]
|
|
54
|
+
}),
|
|
55
|
+
!IS_PROD && (
|
|
56
|
+
serve({
|
|
57
|
+
open: false,
|
|
58
|
+
contentBase: ['dist', 'example'],
|
|
59
|
+
historyApiFallback: true,
|
|
60
|
+
host: 'localhost',
|
|
61
|
+
port: PORT,
|
|
62
|
+
})
|
|
63
|
+
),
|
|
64
|
+
],
|
|
65
|
+
};
|