@jhqn/utils-core 0.0.3-beta.1 → 0.0.3-beta.3
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/dist/index.cjs +3 -3
- package/dist/index.d.cts +10 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +3 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -158,14 +158,14 @@ const isTel = (val) => {
|
|
|
158
158
|
const isEmail = (val) => {
|
|
159
159
|
if (!isDef(val))
|
|
160
160
|
return false;
|
|
161
|
-
const reg = /^[a-
|
|
161
|
+
const reg = /^[a-z\d](?:\w|-)+@[a-z\d]+\.[a-z]{2,5}$/i;
|
|
162
162
|
return reg.test(val);
|
|
163
163
|
};
|
|
164
164
|
const isIdCard = (val, compatible = true) => {
|
|
165
165
|
if (!isDef(val))
|
|
166
166
|
return false;
|
|
167
|
-
const card15 = /^[1-9]\d{7}(?:0[1-9]|10|11|12)(?:[0-2][1-9]|10|20|30|31)\d{2}[\
|
|
168
|
-
const card18 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:[0-2][1-9]|10|20|30|31)\d{3}[\
|
|
167
|
+
const card15 = /^[1-9]\d{7}(?:0[1-9]|10|11|12)(?:[0-2][1-9]|10|20|30|31)\d{2}[\dX]$/i;
|
|
168
|
+
const card18 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:[0-2][1-9]|10|20|30|31)\d{3}[\dX]$/i;
|
|
169
169
|
return card18.test(val) || (compatible ? card15.test(val) : false);
|
|
170
170
|
};
|
|
171
171
|
const isNumeric = (val) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -362,6 +362,15 @@ declare const fixiOSInputAutoZoomIn: () => void;
|
|
|
362
362
|
declare const userAgent: string;
|
|
363
363
|
/**
|
|
364
364
|
* 获取宿主环境信息
|
|
365
|
+
* @returns {HostEnv} 宿主环境信息
|
|
366
|
+
* @example
|
|
367
|
+
* const hostEnv = getHostEnv()
|
|
368
|
+
* hostEnv.zlb // 浙里办
|
|
369
|
+
* hostEnv.zyd // 专有钉
|
|
370
|
+
* hostEnv.zzd // 浙政钉
|
|
371
|
+
* hostEnv.wx // 微信
|
|
372
|
+
* hostEnv.zfb // 支付宝
|
|
373
|
+
* hostEnv.mini // 小程序
|
|
365
374
|
*/
|
|
366
375
|
declare const getHostEnv: () => HostEnv;
|
|
367
376
|
|
|
@@ -383,7 +392,7 @@ declare const getCodeOfMonth: () => number;
|
|
|
383
392
|
* @param str
|
|
384
393
|
* @param reviver
|
|
385
394
|
*/
|
|
386
|
-
declare const parseToJSON: <T = any>(str: string, reviver?: (
|
|
395
|
+
declare const parseToJSON: <T = any>(str: string, reviver?: (this: any, key: string, value: any) => any) => Nullable<T>;
|
|
387
396
|
/**
|
|
388
397
|
* JSON.stringify() second param
|
|
389
398
|
* @param _
|
package/dist/index.d.mts
CHANGED
|
@@ -362,6 +362,15 @@ declare const fixiOSInputAutoZoomIn: () => void;
|
|
|
362
362
|
declare const userAgent: string;
|
|
363
363
|
/**
|
|
364
364
|
* 获取宿主环境信息
|
|
365
|
+
* @returns {HostEnv} 宿主环境信息
|
|
366
|
+
* @example
|
|
367
|
+
* const hostEnv = getHostEnv()
|
|
368
|
+
* hostEnv.zlb // 浙里办
|
|
369
|
+
* hostEnv.zyd // 专有钉
|
|
370
|
+
* hostEnv.zzd // 浙政钉
|
|
371
|
+
* hostEnv.wx // 微信
|
|
372
|
+
* hostEnv.zfb // 支付宝
|
|
373
|
+
* hostEnv.mini // 小程序
|
|
365
374
|
*/
|
|
366
375
|
declare const getHostEnv: () => HostEnv;
|
|
367
376
|
|
|
@@ -383,7 +392,7 @@ declare const getCodeOfMonth: () => number;
|
|
|
383
392
|
* @param str
|
|
384
393
|
* @param reviver
|
|
385
394
|
*/
|
|
386
|
-
declare const parseToJSON: <T = any>(str: string, reviver?: (
|
|
395
|
+
declare const parseToJSON: <T = any>(str: string, reviver?: (this: any, key: string, value: any) => any) => Nullable<T>;
|
|
387
396
|
/**
|
|
388
397
|
* JSON.stringify() second param
|
|
389
398
|
* @param _
|
package/dist/index.d.ts
CHANGED
|
@@ -362,6 +362,15 @@ declare const fixiOSInputAutoZoomIn: () => void;
|
|
|
362
362
|
declare const userAgent: string;
|
|
363
363
|
/**
|
|
364
364
|
* 获取宿主环境信息
|
|
365
|
+
* @returns {HostEnv} 宿主环境信息
|
|
366
|
+
* @example
|
|
367
|
+
* const hostEnv = getHostEnv()
|
|
368
|
+
* hostEnv.zlb // 浙里办
|
|
369
|
+
* hostEnv.zyd // 专有钉
|
|
370
|
+
* hostEnv.zzd // 浙政钉
|
|
371
|
+
* hostEnv.wx // 微信
|
|
372
|
+
* hostEnv.zfb // 支付宝
|
|
373
|
+
* hostEnv.mini // 小程序
|
|
365
374
|
*/
|
|
366
375
|
declare const getHostEnv: () => HostEnv;
|
|
367
376
|
|
|
@@ -383,7 +392,7 @@ declare const getCodeOfMonth: () => number;
|
|
|
383
392
|
* @param str
|
|
384
393
|
* @param reviver
|
|
385
394
|
*/
|
|
386
|
-
declare const parseToJSON: <T = any>(str: string, reviver?: (
|
|
395
|
+
declare const parseToJSON: <T = any>(str: string, reviver?: (this: any, key: string, value: any) => any) => Nullable<T>;
|
|
387
396
|
/**
|
|
388
397
|
* JSON.stringify() second param
|
|
389
398
|
* @param _
|
package/dist/index.mjs
CHANGED
|
@@ -147,14 +147,14 @@ const isTel = (val) => {
|
|
|
147
147
|
const isEmail = (val) => {
|
|
148
148
|
if (!isDef(val))
|
|
149
149
|
return false;
|
|
150
|
-
const reg = /^[a-
|
|
150
|
+
const reg = /^[a-z\d](?:\w|-)+@[a-z\d]+\.[a-z]{2,5}$/i;
|
|
151
151
|
return reg.test(val);
|
|
152
152
|
};
|
|
153
153
|
const isIdCard = (val, compatible = true) => {
|
|
154
154
|
if (!isDef(val))
|
|
155
155
|
return false;
|
|
156
|
-
const card15 = /^[1-9]\d{7}(?:0[1-9]|10|11|12)(?:[0-2][1-9]|10|20|30|31)\d{2}[\
|
|
157
|
-
const card18 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:[0-2][1-9]|10|20|30|31)\d{3}[\
|
|
156
|
+
const card15 = /^[1-9]\d{7}(?:0[1-9]|10|11|12)(?:[0-2][1-9]|10|20|30|31)\d{2}[\dX]$/i;
|
|
157
|
+
const card18 = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:[0-2][1-9]|10|20|30|31)\d{3}[\dX]$/i;
|
|
158
158
|
return card18.test(val) || (compatible ? card15.test(val) : false);
|
|
159
159
|
};
|
|
160
160
|
const isNumeric = (val) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jhqn/utils-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.3-beta.
|
|
4
|
+
"version": "0.0.3-beta.3",
|
|
5
5
|
"author": "jade-gjz <jiangang.zhang@jaderd.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/jaderd-jh/utils/tree/main/packages/core#readme",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"dayjs": "^1.11.
|
|
40
|
+
"dayjs": "^1.11.11",
|
|
41
41
|
"detect-browser": "^5.3.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|