@polyv/utils 1.5.1 → 2.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/README.md +33 -18
- package/dist/cjs/boolean.d.ts +45 -0
- package/dist/cjs/boolean.js +1 -0
- package/dist/cjs/countdown.d.ts +97 -0
- package/dist/cjs/countdown.js +1 -0
- package/dist/cjs/date.d.ts +44 -0
- package/dist/cjs/date.js +1 -0
- package/dist/cjs/json.d.ts +43 -0
- package/dist/cjs/json.js +1 -0
- package/dist/cjs/net.d.ts +32 -0
- package/dist/cjs/net.js +1 -0
- package/dist/cjs/string.d.ts +94 -0
- package/dist/cjs/string.js +1 -0
- package/dist/cjs/validate.d.ts +26 -0
- package/dist/cjs/validate.js +1 -0
- package/dist/es/boolean.d.ts +45 -0
- package/dist/es/boolean.js +1 -0
- package/dist/es/countdown.d.ts +97 -0
- package/dist/es/countdown.js +1 -0
- package/dist/es/date.d.ts +44 -0
- package/dist/es/date.js +1 -0
- package/dist/es/json.d.ts +43 -0
- package/dist/es/json.js +1 -0
- package/dist/es/net.d.ts +32 -0
- package/dist/es/net.js +1 -0
- package/dist/es/string.d.ts +94 -0
- package/dist/es/string.js +1 -0
- package/dist/es/validate.d.ts +26 -0
- package/dist/es/validate.js +1 -0
- package/package.json +31 -26
- package/dist/boolean.js +0 -1
- package/dist/browser.js +0 -1
- package/dist/cookie.js +0 -1
- package/dist/countdown.js +0 -1
- package/dist/date.js +0 -1
- package/dist/lang.js +0 -1
- package/dist/net.js +0 -1
- package/dist/polling.js +0 -1
- package/dist/querystring.js +0 -1
- package/dist/storage.js +0 -1
- package/dist/string.js +0 -1
- package/dist/validate.js +0 -1
- package/src/boolean.js +0 -67
- package/src/browser.js +0 -81
- package/src/cookie.js +0 -115
- package/src/countdown.js +0 -91
- package/src/date.js +0 -92
- package/src/internal/core.js +0 -59
- package/src/internal/timeunit.js +0 -63
- package/src/lang.js +0 -120
- package/src/net.js +0 -54
- package/src/polling.js +0 -142
- package/src/querystring.js +0 -121
- package/src/storage.js +0 -106
- package/src/string.js +0 -105
- package/src/validate.js +0 -42
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本模块提供日期和时间处理的相关方法。
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 格式化日期。
|
|
7
|
+
* @param date 日期对象或时间戳(毫秒)。
|
|
8
|
+
* @param formation 格式。
|
|
9
|
+
* @return 格式化结果。
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* formatDate(new Date(2018, 9, 8, 8, 50, 56), 'YYYY-MM-DD hh:mm:ss'); // '2018-10-08 08:50:56'
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatDate(date: number | Date, formation: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* 秒数格式化配置。
|
|
18
|
+
*/
|
|
19
|
+
export interface FormatSecondsOptions {
|
|
20
|
+
/**
|
|
21
|
+
* 段数,2 或者 3。
|
|
22
|
+
* 为 3 时,格式化样式为「时:分:秒」。
|
|
23
|
+
* 为 2 时,如果小时为 0,则格式化样式为「分:秒」,否则与段数为 3 时一致。
|
|
24
|
+
*/
|
|
25
|
+
segments?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 每一段数字的最小位数,不足位数时补 0。
|
|
28
|
+
*/
|
|
29
|
+
digits?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 把秒数格式化成“时:分:秒”格式。
|
|
33
|
+
* @param secs 秒数。
|
|
34
|
+
* @param options 格式化配置。
|
|
35
|
+
* @return 格式化结果。
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* formatSeconds(3682); // '01:01:22'
|
|
39
|
+
* formatSeconds(82); // '01:22'
|
|
40
|
+
* formatSeconds(82, { segments: 3 }); // '00:01:22'
|
|
41
|
+
* formatSeconds(3682, { digits: 1 }); // '1:1:22'
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatSeconds(secs: number, options?: FormatSecondsOptions): string;
|
package/dist/es/date.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function ensureDate(t){return"object"!=typeof t&&(t=new Date(t)),t}export function formatDate(t,e){const n={Y:(t=ensureDate(t)).getFullYear(),M:t.getMonth()+1,D:t.getDate(),h:t.getHours(),m:t.getMinutes(),s:t.getSeconds()};return e.replace(/([YMDhms])\1*/g,(function(t){let e=n[t[0]].toString();const r=t.length;return r>e.length&&(e=new Array(r-e.length+1).join("0")+e),e}))}export function formatSeconds(t,e={segments:2,digits:2}){if(t=Number(t),isNaN(t)||t<0)throw new Error('"secs" must be a positive integer');let n=0|(e.segments||2),r=0|(e.digits||2);r=Math.max(1,r),-1===[2,3].indexOf(n)&&(n=2);const o=new Array(r+1).join("0"),s=[3600,60,1].map((e=>{const n=Math.floor(t/e),s=n.toString().length;return t%=e,(o+n).slice(-Math.max(s,r))}));return n<3&&!Number(s[0])&&s.shift(),s.join(":")}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本模块提供 json 处理相关方法。
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 深度克隆指定对象(仅限 JSON 支持的数据类型)。
|
|
7
|
+
* @param obj 指定对象。
|
|
8
|
+
* @return 克隆结果。
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* cloneJSON({ a: 1, b: 2 }); // { a: 1, b: 2 }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function cloneJSON(obj: unknown): any;
|
|
15
|
+
/**
|
|
16
|
+
* JSON 字符串解析失败时的回调。
|
|
17
|
+
*/
|
|
18
|
+
export interface IErrorCallback {
|
|
19
|
+
(e: Error): unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 尝试把指定字符串解析为 JSON 对象。
|
|
23
|
+
* @param str 指定字符串。
|
|
24
|
+
* @param onError 解析出错时执行的回调函数。函数返回值会作为解析失败时的解析结果。
|
|
25
|
+
* @return 解析结果。
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* tryParseJSON('ss&&**'); // undefined
|
|
29
|
+
* tryParseJSON('{"a": 1}'); // { a: 1 }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function tryParseJSON(str: string, onError?: IErrorCallback): unknown;
|
|
33
|
+
/**
|
|
34
|
+
* 尝试把指定字符串解析为 JSON 对象。
|
|
35
|
+
* @param str 指定字符串。
|
|
36
|
+
* @param defaultValue 解析出错时的默认结果。
|
|
37
|
+
* @return 解析结果。
|
|
38
|
+
* @example
|
|
39
|
+
* ```javascript
|
|
40
|
+
* tryParseJSON('12&&**', 1); // 1
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function tryParseJSON(str: string, defaultValue?: unknown): unknown;
|
package/dist/es/json.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function cloneJSON(t){return null==t?t:JSON.parse(JSON.stringify(t))}export function tryParseJSON(t,r){let n;try{n=JSON.parse(t)}catch(t){n="function"==typeof r?r(t):r}return n}
|
package/dist/es/net.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本模块提供网络协议相关方法。
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 检查目标字符串是否以特定 URL 协议开头。
|
|
7
|
+
* @param str 目标字符串。
|
|
8
|
+
* @param protocols 特定协议(不含冒号和斜杠),不指定时表示允许任何协议。
|
|
9
|
+
* @return 目标字符串是否以特定 URL 协议开头。
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* startsWithProtocol('//abc.com'); // true
|
|
13
|
+
* startsWithProtocol('https://abc.com'); // true
|
|
14
|
+
* startsWithProtocol('file:///Users/'); // true
|
|
15
|
+
* startsWithProtocol('abc.com'); // false
|
|
16
|
+
* startsWithProtocol('http://abc.com', ['http', 'https']); // true
|
|
17
|
+
* startsWithProtocol('ftp://abc.com', ['http', 'https']); // false
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function startsWithProtocol(str: string, protocols?: string[]): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 替换目标字符串中的 URL 协议。如果字符串中不包含协议,则加上协议。
|
|
23
|
+
* @param url 目标字符串。
|
|
24
|
+
* @param protocol 协议。
|
|
25
|
+
* @return 替换结果。
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* changeProtocol('abc.com', 'https'); // 'https://abc.com'
|
|
29
|
+
* changeProtocol('http://abc.com', 'https'); // 'https://abc.com'
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function changeProtocol(url: string, protocol: string): string;
|
package/dist/es/net.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const reProtocol=/^(?:([a-z]+):)?\/{2,3}/i;export function startsWithProtocol(o,t){const r=reProtocol.test(o);if(r&&t){const o=(RegExp.$1||"").toLowerCase();for(let r=t.length-1;r>=0;r--)if(o===t[r].toLowerCase())return!0;return!1}return r}export function changeProtocol(o,t){return reProtocol.test(t)||(t+="://"),startsWithProtocol(o)?o.replace(reProtocol,t):t+o}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本模块提供字符串处理相关方法。
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 计算字符串长度的选项。
|
|
7
|
+
*/
|
|
8
|
+
export interface IStrLenOptions {
|
|
9
|
+
/**
|
|
10
|
+
* 英文字符单位长度。
|
|
11
|
+
*/
|
|
12
|
+
enLen?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 非英文字符单位长度。
|
|
15
|
+
*/
|
|
16
|
+
nonEnLen?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 裁剪字符串的选项。
|
|
20
|
+
*/
|
|
21
|
+
export interface ICutStrOptions extends IStrLenOptions {
|
|
22
|
+
/**
|
|
23
|
+
* 省略符,默认为三个点号。
|
|
24
|
+
*/
|
|
25
|
+
ellipsis?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 计算字符串长度。默认情况下,英文字符的单位长度为 1,非英文字符的单位长度为 2。
|
|
29
|
+
* @param str 字符串。
|
|
30
|
+
* @param options 为数字时表示非英文字符单位长度(此时英文字符单位长度为 1);为 Object 时表示选项。
|
|
31
|
+
* @return 字符串长度。
|
|
32
|
+
* @example
|
|
33
|
+
* ```javascript
|
|
34
|
+
* strLen('abcde;'); // 6
|
|
35
|
+
* strLen('abc测试;'); // 9
|
|
36
|
+
* strLen('abc测试;', 1); // 6
|
|
37
|
+
* strLen('abc测试;', { enLen: 0.5, nonEnLen: 1 }); // 4.5
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function strLen(str: string, options?: number | IStrLenOptions): number;
|
|
41
|
+
/**
|
|
42
|
+
* 如果目标字符串超出限制长度,则进行截断并拼接省略符号;否则返回目标字符串。
|
|
43
|
+
* 默认情况下,英文字符的单位长度为 1,非英文字符的单位长度为 2。
|
|
44
|
+
* @param str 目标字符串。
|
|
45
|
+
* @param length 限制的长度。
|
|
46
|
+
* @param options 选项。
|
|
47
|
+
* @return 截断后的字符串。
|
|
48
|
+
* @example
|
|
49
|
+
* ```javascript
|
|
50
|
+
* cutStr('测试一下', 5); // '测试...'
|
|
51
|
+
* cutStr('测试一下', 8); // '测试一下'
|
|
52
|
+
* curStr('1测试2测试3', 3.5, { enLen: 0.5, nonEnLen: 1 }); // 1测...
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function cutStr(str: string, length: number, options?: ICutStrOptions): string;
|
|
56
|
+
/**
|
|
57
|
+
* 把指定字符串中的 HTML 预留字符替换成 HTML 实体。
|
|
58
|
+
* @param str 指定字符串。
|
|
59
|
+
* @return 替换后的字符串。
|
|
60
|
+
*/
|
|
61
|
+
export declare function escapeHTML(str: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* 移除指定字符串中的 HTML 标签。
|
|
64
|
+
* @param str 指定字符串。
|
|
65
|
+
* @return 处理后的字符串。
|
|
66
|
+
*/
|
|
67
|
+
export declare function removeTags(str: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* 把指定字符串中的换行符替换成 <br />。
|
|
70
|
+
* @param str 指定字符串。
|
|
71
|
+
* @return 替换后的字符串。
|
|
72
|
+
*/
|
|
73
|
+
export declare function nl2br(str: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* 生成随机字符串。
|
|
76
|
+
* @param length 字符串长度。
|
|
77
|
+
* @param prefix 字符串前缀(不计入长度)。
|
|
78
|
+
* @returns 生成的随机字符串。
|
|
79
|
+
*/
|
|
80
|
+
export declare function randomStr(length: number, prefix?: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* 生成 uuid(v4)。
|
|
83
|
+
* @returns uuid。
|
|
84
|
+
*/
|
|
85
|
+
export declare function uuidV4(): string;
|
|
86
|
+
/**
|
|
87
|
+
* 版本号对比。
|
|
88
|
+
* @param versionA 待比较版本 A。
|
|
89
|
+
* @param versionB 待比较版本 B。
|
|
90
|
+
* @return 大于 0 时,表示版本 A 大于版本 B;
|
|
91
|
+
* 小于 0 时,表示版本 B 大于版本 A;
|
|
92
|
+
* 等于 0 时,表示两个版本号一致。
|
|
93
|
+
*/
|
|
94
|
+
export declare function compareVersions(verA: string, verB: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function strLen(n,e){var r,t;"number"==typeof e?e={enLen:1,nonEnLen:e}:((e=e||{}).enLen=null!==(r=e.enLen)&&void 0!==r?r:1,e.nonEnLen=null!==(t=e.nonEnLen)&&void 0!==t?t:2);let o=0;for(let r=n.length-1;r>=0;r--)o+=n.charCodeAt(r)>255?e.nonEnLen||0:e.enLen||0;return o}export function cutStr(n,e,r){(r=r||{}).enLen=Number(r.enLen)||1,r.nonEnLen=Number(r.nonEnLen)||2,r.ellipsis=r.ellipsis||"...";const t=strLen(n=String(n),r);if(t<=e)return n;e-=strLen(r.ellipsis,r);let o="",l=-1;for(;e>0&&++l<t;)(e-=n.charCodeAt(l)>255?r.nonEnLen:r.enLen)>=0&&(o+=n.charAt(l));return o+=r.ellipsis,o}export function escapeHTML(n){if(null==n)return n;const e={'"':""","'":"'","&":"&","<":"<",">":">"};return String(n).replace(/["'&<>]/g,(n=>e[n]))}export function removeTags(n){return null==n?"":String(n).replace(/<.+?>/g,"")}export function nl2br(n){return null==n?n:String(n).replace(/\r?\n/g,"<br />")}export function randomStr(n,e){if(!(n|=0)||n<0)throw new Error('"length" must be a number greater than 0');let r="";do{r+=Math.random().toString(36).substr(2)}while(r.length<n);return r=r.substr(0,n),null!=e&&(r=e+r),r}export function uuidV4(){let n=Date.now();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(n+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const r=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?r:3&r|8).toString(16)}))}export function compareVersions(n,e){if(!n||!e)throw new Error("Please specify both verA and verB");const r=/(\.0+)+$/,t=String(n).replace(r,"").split("."),o=String(e).replace(r,"").split("."),l=Math.min(t.length,o.length);for(let n=0;n<l;n++){const e=parseInt(t[n])-parseInt(o[n]);if(e)return e}return t.length-o.length}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本模块提供数据验证方法。
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 检查目标字符串是否中国大陆手机号。
|
|
7
|
+
* @param str 目标字符串。
|
|
8
|
+
* @return 目标字符串是否中国大陆手机号。
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* isChsPhoneNO('13800138000'); // true
|
|
12
|
+
* isChsPhoneNO('a13800138000c'); // false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isChsPhoneNO(str: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 检查目标字符串是否电子邮箱地址。
|
|
18
|
+
* @param str 目标字符串。
|
|
19
|
+
* @return 目标字符串是否电子邮箱地址。
|
|
20
|
+
* @example
|
|
21
|
+
* ```javascript
|
|
22
|
+
* isEmail('me@polyv.net'); // true
|
|
23
|
+
* isEmail('me@polyv_.net-'); // false
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function isEmail(str: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function isChsPhoneNO(t){return/^1[3-9]\d{9}$/.test(t)}export function isEmail(t){if(/^[\w-]+(?:\.[\w-]+)*@[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,}$/.test(t)){const e=t.replace("@",".").split(".");for(let t=e.length-1;t>=0;t--)if(/^[-_]/.test(e[t])||/[_-]$/.test(e[t]))return!1;return!0}return!1}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polyv/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "Utility functions of Polyv frontend development.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyv",
|
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.config.js",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
12
|
+
"gen-doc": "rimraf ./docs/2.x && typedoc --options ./typedoc.js --tsconfig ./src/tsconfig.json",
|
|
13
|
+
"lint": "eslint ./src/*.ts",
|
|
14
|
+
"compress": "node ./build/compress-js",
|
|
15
|
+
"build": "npm run lint && rimraf ./dist/** && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.es5.json && npm run compress"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"src/**/*",
|
|
19
18
|
"dist/**/*"
|
|
20
19
|
],
|
|
21
20
|
"author": "Polyv frontend team",
|
|
@@ -29,31 +28,37 @@
|
|
|
29
28
|
},
|
|
30
29
|
"homepage": "https://polyv.github.io/fed-common-utils/index.html",
|
|
31
30
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
31
|
+
"node": ">=10.0.0"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"@babel/core": "^7.
|
|
36
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
37
|
-
"@babel/plugin-proposal-json-strings": "^7.
|
|
34
|
+
"@babel/core": "^7.16.0",
|
|
35
|
+
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
36
|
+
"@babel/plugin-proposal-json-strings": "^7.16.0",
|
|
38
37
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
39
38
|
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
40
|
-
"@babel/preset-env": "^7.
|
|
39
|
+
"@babel/preset-env": "^7.16.4",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
41
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
41
42
|
"babel-eslint": "^10.1.0",
|
|
42
|
-
"babel-loader": "^8.
|
|
43
|
-
"copy-webpack-plugin": "^6.
|
|
44
|
-
"core-js": "^
|
|
45
|
-
"cross-env": "^7.0.
|
|
46
|
-
"eslint": "^
|
|
47
|
-
"eslint-
|
|
48
|
-
"eslint-plugin
|
|
49
|
-
"glob": "^7.
|
|
50
|
-
"html-webpack-plugin": "^4.
|
|
51
|
-
"
|
|
52
|
-
"regenerator-runtime": "^0.13.7",
|
|
43
|
+
"babel-loader": "^8.2.3",
|
|
44
|
+
"copy-webpack-plugin": "^6.4.1",
|
|
45
|
+
"core-js": "^3.19.2",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"eslint": "^8.3.0",
|
|
48
|
+
"eslint-plugin-sonarjs": "^0.11.0",
|
|
49
|
+
"eslint-webpack-plugin": "^3.1.1",
|
|
50
|
+
"glob": "^7.2.0",
|
|
51
|
+
"html-webpack-plugin": "^4.5.2",
|
|
52
|
+
"regenerator-runtime": "^0.13.9",
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
|
-
"
|
|
54
|
+
"terser": "^5.10.0",
|
|
55
|
+
"ts-loader": "^8.3.0",
|
|
56
|
+
"typedoc": "^0.22.10",
|
|
57
|
+
"typescript": "^4.5.2",
|
|
58
|
+
"webpack": "^4.46.0",
|
|
55
59
|
"webpack-cli": "^3.3.12",
|
|
56
|
-
"webpack-dev-server": "^3.11.
|
|
57
|
-
"webpack-merge": "^5.0
|
|
58
|
-
}
|
|
60
|
+
"webpack-dev-server": "^3.11.3",
|
|
61
|
+
"webpack-merge": "^5.8.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {}
|
|
59
64
|
}
|
package/dist/boolean.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)r.d(t,o,function(n){return e[n]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=3)}({3:function(e,n,r){"use strict";function t(e){if("boolean"!=typeof e)throw new Error("The value argument must be a boolean type");return e?"Y":"N"}function o(e){if("Y"!==(e=String(e).toUpperCase())&&"N"!==e)throw new Error('The value argument must be "Y" or "N"');return"Y"===e}function u(e){return e.every(o)}function i(e){return e.some(o)}function f(e){return e.every((function(e){return!o(e)}))}function c(e){return e.some((function(e){return!o(e)}))}r.r(n),r.d(n,"boolToYN",(function(){return t})),r.d(n,"ynToBool",(function(){return o})),r.d(n,"allY",(function(){return u})),r.d(n,"someY",(function(){return i})),r.d(n,"allN",(function(){return f})),r.d(n,"someN",(function(){return c}))}});
|
package/dist/browser.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(n){var t={};function e(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:r})},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,t){if(1&t&&(n=e(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)e.d(r,o,function(t){return n[t]}.bind(null,o));return r},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=4)}({4:function(n,t,e){"use strict";function r(n){return n||"undefined"==typeof navigator||(n=navigator.userAgent),n}function o(n){return n=r(n),/mobile|android/i.test(n)||!/\b(Windows\sNT|Macintosh|Linux)\b/.test(n)}function i(n){return n=r(n),/\bMicroMessenger\//.test(n)}function u(n){return i(n=r(n))&&/\bwxwork\b/.test(n)}function f(n){return n=r(n),!(!/\bMSIE\s(\d+)/i.test(n)&&!/\bTrident\/.*;\srv:(\d+)/.test(n))&&RegExp.$1}function c(n){return n=r(n),/\b(?:Android|Adr)\b/.test(n)}function d(n){return n=r(n),/\b(?:iPad|iPod|iPhone)\b/.test(n)}e.r(t),e.d(t,"isMobile",(function(){return o})),e.d(t,"isWeixin",(function(){return i})),e.d(t,"isWorkWeixin",(function(){return u})),e.d(t,"ieVersion",(function(){return f})),e.d(t,"isAndroid",(function(){return c})),e.d(t,"isIOS",(function(){return d}))}});
|
package/dist/cookie.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=13)}({0:function(e,n,t){"use strict";(function(e){t.d(n,"b",(function(){return o})),t.d(n,"a",(function(){return i})),t.d(n,"d",(function(){return f})),t.d(n,"c",(function(){return a})),t.d(n,"e",(function(){return u}));var r=Object.prototype.hasOwnProperty;function o(e,n){return r.call(e,n)}function i(e,n){var t,r;if(null!=n)for(t in n)r=n[t],"__proto__"!==t&&e!==r&&o(n,t)&&(e[t]=r)}var u,c=Object.prototype.toString;function f(e){return"[object Object]"===c.call(e)}function a(e){return"[object Date]"===c.call(e)}u="undefined"!=typeof window?window:void 0!==e?e:null}).call(this,t(2))},13:function(e,n,t){"use strict";t.r(n),t.d(n,"set",(function(){return u})),t.d(n,"get",(function(){return c})),t.d(n,"remove",(function(){return a}));var r=t(0),o={SEC:1e3,MIN:6e4,HOUR:36e5,DAY:864e5,MONTH:2592e6,YEAR:31536e6};function i(e,n){return new Date(("number"==typeof e?e:e.getTime())+function(e){if("number"==typeof e)return e;if(!isNaN(e))return Number(e);var n=parseFloat(e);if(isNaN(n))throw new Error("Invalid timespan string");var t=e.split(n)[1].trim().toUpperCase().replace(/S$/,"");if(Object(r.b)(o,t))return n*o[t];throw new Error('Invalid time unit "'+t+'"')}(n))}function u(e,n,t){t=t||{};var o=encodeURIComponent(e)+"="+encodeURIComponent(n);if(null!=t.expires&&(o+="; expires="+(Object(r.c)(t.expires)?t.expires:i(new Date,t.expires)).toUTCString()),t.path&&(o+="; path="+t.path),t.domain&&(o+="; domain="+t.domain),!0===t.secure&&(o+="; secure"),t.sameSite){var u=String(t.sameSite).toLowerCase();-1!==["lax","strict","none"].indexOf(u)&&(o+="; samesite="+u)}document.cookie=o}function c(e){e="; "+encodeURIComponent(e)+"=";var n="; "+document.cookie,t=n.indexOf(e);if(-1===t)return null;t+=e.length;var r=n.indexOf(";",t);return-1===r&&(r=n.length),decodeURIComponent(n.substring(t,r))}var f=function(){if("undefined"==typeof document)return!1;var e="__jraiser__test__cookie__";return document.cookie=e+"=1",document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT",!!c(e)}();function a(e,n){f&&u(e,"",n),(n=n||{}).expires=new Date(0),u(e,"",n)}},2:function(e,n){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":t(window))&&(r=window)}e.exports=r}});
|
package/dist/countdown.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}({5:function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}n.r(e),n.d(e,"default",(function(){return o}));var i=[{divisor:864e5,unit:"days"},{divisor:36e5,unit:"hours"},{divisor:6e4,unit:"minutes"},{divisor:1e3,unit:"seconds"}],o=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=parseInt(e),isNaN(e))throw new Error("Total seconds must be a number");this._secs=1e3*e,this._cb="function"==typeof n?n:function(){}}var e,n,o;return e=t,(n=[{key:"_exec",value:function(){var t=this;if(this._startTime){var e=Math.max(0,this._secs-(Date.now()-this._startTime));if(e>0&&!this._stopped&&setTimeout((function(){t._exec()}),1e3),e>=0){var n={totalMsecs:e};i.forEach((function(t,r){n[t.unit]=e/t.divisor,r===i.length-1?n[t.unit]=Math.round(n[t.unit]):(n[t.unit]=Math.floor(n[t.unit]),e%=t.divisor)})),this._cb(n)}}}},{key:"start",value:function(){this.secs<=0||(this._startTime=Date.now(),this._exec())}},{key:"stop",value:function(){this._timerId&&clearTimeout(this._timerId),this._stopped=!0}}])&&r(e.prototype,n),o&&r(e,o),t}()}});
|
package/dist/date.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=6)}([function(t,n,e){"use strict";(function(t){e.d(n,"b",(function(){return o})),e.d(n,"a",(function(){return u})),e.d(n,"d",(function(){return c})),e.d(n,"c",(function(){return l})),e.d(n,"e",(function(){return i}));var r=Object.prototype.hasOwnProperty;function o(t,n){return r.call(t,n)}function u(t,n){var e,r;if(null!=n)for(e in n)r=n[e],"__proto__"!==e&&t!==r&&o(n,e)&&(t[e]=r)}var i,f=Object.prototype.toString;function c(t){return"[object Object]"===f.call(t)}function l(t){return"[object Date]"===f.call(t)}i="undefined"!=typeof window?window:void 0!==t?t:null}).call(this,e(2))},function(t,n,e){"use strict";e.r(n),e.d(n,"isArrayLike",(function(){return o})),e.d(n,"isEmptyData",(function(){return u})),e.d(n,"extend",(function(){return i})),e.d(n,"cloneJSON",(function(){return f})),e.d(n,"tryParseJSON",(function(){return c}));var r=e(0);function o(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}function u(t){if(null==t)return!0;if("string"==typeof t)return""===t.trim();if(Array.isArray(t))return!t.length;if(Object(r.d)(t)){for(var n in t)if(Object(r.b)(t,n))return!1;return!0}return!1}function i(t){if(null==t)throw new Error("The target argument cannot be null or undefined");for(var n=arguments.length,e=0;++e<n;)Object(r.a)(t,arguments[e]);return t}function f(t){return null==t?t:JSON.parse(JSON.stringify(t))}function c(t){var n;try{n=JSON.parse(t)}catch(t){}return n}e.d(n,"hasOwnProp",(function(){return r.b}))},function(t,n){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":e(window))&&(r=window)}t.exports=r},,,,function(t,n,e){"use strict";e.r(n),e.d(n,"ensureDate",(function(){return u})),e.d(n,"formatDate",(function(){return i})),e.d(n,"formatSeconds",(function(){return f}));var r=e(1);function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t){return"object"!==o(t)&&(t=new Date(t)),t}function i(t,n){var e={Y:(t=u(t)).getFullYear(),M:t.getMonth()+1,D:t.getDate(),h:t.getHours(),m:t.getMinutes(),s:t.getSeconds()};return n.replace(/([YMDhms])\1*/g,(function(t){var n=e[t[0]];return t.length>1&&n.toString().length!==t.length&&(n=(new Array(t.length).join("0")+n).slice(-t.length)),n}))}function f(t,n){if(t=Number(t),isNaN(t)||t<0)throw new Error('"secs" must be a positive integer');(n=Object(r.extend)({},n)).segments=parseInt(n.segments),n.digits=Math.max(1,parseInt(n.digits)||2),-1===[2,3].indexOf(n.segments)&&(n.segments=2);var e=new Array(n.digits+1).join("0"),o=[3600,60,1].map((function(r){var o=Math.floor(t/r),u=o.toString().length;return t%=r,(e+o).slice(-Math.max(u,n.digits))}));return n.segments<3&&!Number(o[0])&&o.shift(),o.join(":")}}]);
|
package/dist/lang.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(n){var t={};function r(e){if(t[e])return t[e].exports;var o=t[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)r.d(e,o,function(t){return n[t]}.bind(null,o));return e},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=1)}([function(n,t,r){"use strict";(function(n){r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return l})),r.d(t,"e",(function(){return i}));var e=Object.prototype.hasOwnProperty;function o(n,t){return e.call(n,t)}function u(n,t){var r,e;if(null!=t)for(r in t)e=t[r],"__proto__"!==r&&n!==e&&o(t,r)&&(n[r]=e)}var i,f=Object.prototype.toString;function c(n){return"[object Object]"===f.call(n)}function l(n){return"[object Date]"===f.call(n)}i="undefined"!=typeof window?window:void 0!==n?n:null}).call(this,r(2))},function(n,t,r){"use strict";r.r(t),r.d(t,"isArrayLike",(function(){return o})),r.d(t,"isEmptyData",(function(){return u})),r.d(t,"extend",(function(){return i})),r.d(t,"cloneJSON",(function(){return f})),r.d(t,"tryParseJSON",(function(){return c}));var e=r(0);function o(n){return null!=n&&"function"!=typeof n&&"number"==typeof n.length&&n.length>=0&&n.length%1==0}function u(n){if(null==n)return!0;if("string"==typeof n)return""===n.trim();if(Array.isArray(n))return!n.length;if(Object(e.d)(n)){for(var t in n)if(Object(e.b)(n,t))return!1;return!0}return!1}function i(n){if(null==n)throw new Error("The target argument cannot be null or undefined");for(var t=arguments.length,r=0;++r<t;)Object(e.a)(n,arguments[r]);return n}function f(n){return null==n?n:JSON.parse(JSON.stringify(n))}function c(n){var t;try{t=JSON.parse(n)}catch(n){}return t}r.d(t,"hasOwnProp",(function(){return e.b}))},function(n,t){function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(n){"object"===("undefined"==typeof window?"undefined":r(window))&&(e=window)}n.exports=e}]);
|
package/dist/net.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=7)}({7:function(e,t,r){"use strict";r.r(t),r.d(t,"startsWithProtocol",(function(){return o})),r.d(t,"changeProtocol",(function(){return u}));var n=/^(?:([a-z]+):)?\/{2,3}/i;function o(e,t){var r=n.test(e);if(r&&t){for(var o=(RegExp.$1||"").toLowerCase(),u=t.length-1;u>=0;u--)if(o===t[u].toLowerCase())return!0;return!1}return r}function u(e,t){return n.test(t)||(t+="://"),o(e)?e.replace(n,t):t+e}}});
|
package/dist/polling.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=8)}([function(t,n,e){"use strict";(function(t){e.d(n,"b",(function(){return i})),e.d(n,"a",(function(){return o})),e.d(n,"d",(function(){return f})),e.d(n,"c",(function(){return a})),e.d(n,"e",(function(){return u}));var r=Object.prototype.hasOwnProperty;function i(t,n){return r.call(t,n)}function o(t,n){var e,r;if(null!=n)for(e in n)r=n[e],"__proto__"!==e&&t!==r&&i(n,e)&&(t[e]=r)}var u,c=Object.prototype.toString;function f(t){return"[object Object]"===c.call(t)}function a(t){return"[object Date]"===c.call(t)}u="undefined"!=typeof window?window:void 0!==t?t:null}).call(this,e(2))},function(t,n,e){"use strict";e.r(n),e.d(n,"isArrayLike",(function(){return i})),e.d(n,"isEmptyData",(function(){return o})),e.d(n,"extend",(function(){return u})),e.d(n,"cloneJSON",(function(){return c})),e.d(n,"tryParseJSON",(function(){return f}));var r=e(0);function i(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}function o(t){if(null==t)return!0;if("string"==typeof t)return""===t.trim();if(Array.isArray(t))return!t.length;if(Object(r.d)(t)){for(var n in t)if(Object(r.b)(t,n))return!1;return!0}return!1}function u(t){if(null==t)throw new Error("The target argument cannot be null or undefined");for(var n=arguments.length,e=0;++e<n;)Object(r.a)(t,arguments[e]);return t}function c(t){return null==t?t:JSON.parse(JSON.stringify(t))}function f(t){var n;try{n=JSON.parse(t)}catch(t){}return n}e.d(n,"hasOwnProp",(function(){return r.b}))},function(t,n){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":e(window))&&(r=window)}t.exports=r},,,,,,function(t,n,e){"use strict";e.r(n),e.d(n,"default",(function(){return u}));var r=e(0),i=e(1);function o(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u=function(){function t(n,e){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._executor=n,this._options=Object(i.extend)({interval:1e3,breakOnError:!1},e),this._timerId=null,this._started=!1,this._isExecuting=!1,this._shouldImmediate=!1}var n,e,u;return n=t,(e=[{key:"_exec",value:function(){var t,n=this;try{t=this._executor.call(r.e)}catch(t){this._options.breakOnError&&this.stop()}t&&"function"==typeof t.then?(this._isExecuting=!0,t.then((function(){n._isExecuting=!1,n._next()}),(function(){n._isExecuting=!1,n._options.breakOnError?n.stop():n._next()}))):this._next()}},{key:"_next",value:function(){var t=this;this._shouldImmediate?this._exec():this._started&&(this._timerId=setTimeout((function(){t._exec()}),this._options.interval))}},{key:"execImmediately",value:function(){this._clearTimeout(),this._isExecuting?this._shouldImmediate=!0:this._exec()}},{key:"start",value:function(){this._started=!0,this._exec()}},{key:"stop",value:function(){this._clearTimeout(),this._started=!1}},{key:"_clearTimeout",value:function(){this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}}])&&o(n.prototype,e),u&&o(n,u),t}()}]);
|
package/dist/querystring.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(n){var t={};function r(e){if(t[e])return t[e].exports;var o=t[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)r.d(e,o,function(t){return n[t]}.bind(null,o));return e},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=9)}([function(n,t,r){"use strict";(function(n){r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return a})),r.d(t,"e",(function(){return i}));var e=Object.prototype.hasOwnProperty;function o(n,t){return e.call(n,t)}function u(n,t){var r,e;if(null!=t)for(r in t)e=t[r],"__proto__"!==r&&n!==e&&o(t,r)&&(n[r]=e)}var i,f=Object.prototype.toString;function c(n){return"[object Object]"===f.call(n)}function a(n){return"[object Date]"===f.call(n)}i="undefined"!=typeof window?window:void 0!==n?n:null}).call(this,r(2))},function(n,t,r){"use strict";r.r(t),r.d(t,"isArrayLike",(function(){return o})),r.d(t,"isEmptyData",(function(){return u})),r.d(t,"extend",(function(){return i})),r.d(t,"cloneJSON",(function(){return f})),r.d(t,"tryParseJSON",(function(){return c}));var e=r(0);function o(n){return null!=n&&"function"!=typeof n&&"number"==typeof n.length&&n.length>=0&&n.length%1==0}function u(n){if(null==n)return!0;if("string"==typeof n)return""===n.trim();if(Array.isArray(n))return!n.length;if(Object(e.d)(n)){for(var t in n)if(Object(e.b)(n,t))return!1;return!0}return!1}function i(n){if(null==n)throw new Error("The target argument cannot be null or undefined");for(var t=arguments.length,r=0;++r<t;)Object(e.a)(n,arguments[r]);return n}function f(n){return null==n?n:JSON.parse(JSON.stringify(n))}function c(n){var t;try{t=JSON.parse(n)}catch(n){}return t}r.d(t,"hasOwnProp",(function(){return e.b}))},function(n,t){function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(n){"object"===("undefined"==typeof window?"undefined":r(window))&&(e=window)}n.exports=e},,,,,,,function(n,t,r){"use strict";r.r(t),r.d(t,"parse",(function(){return o})),r.d(t,"stringify",(function(){return u})),r.d(t,"append",(function(){return i}));var e=r(1);function o(n){if("string"!=typeof n)throw new Error("The str argument must be a string type");var t={};return n.split("&").forEach((function(n){if(n){n=n.split("=");var r=decodeURIComponent(n[0]),o=decodeURIComponent(n[1]||"");Object(e.hasOwnProp)(t,r)?(Array.isArray(t[r])||(t[r]=[t[r]]),t[r].push(o)):t[r]=o}})),t}function u(n,t){t=t||{};var r,o,u=[];function i(n,r){null==r&&(r=""),""===r&&t.ignoreEmpty||u.push(encodeURIComponent(n)+"="+encodeURIComponent(r))}function f(n){i(r,n)}for(r in n)Object(e.hasOwnProp)(n,r)&&(o=n[r],Array.isArray(o)?o.forEach(f):i(r,o));return u.join("&")}function i(n,t,r){if(null==n)return n;var e=(n=String(n)).indexOf("#"),o="";return-1!==e&&(o=n.substring(e,n.length),n=n.substring(0,e)),n=n.replace(/[?&]$/,""),t="string"!=typeof t?u(t,r):t.replace(/^[?&]/,""),n+(-1!==n.indexOf("?")?"&":"?")+t+o}}]);
|
package/dist/storage.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=10)}([function(t,n,e){"use strict";(function(t){e.d(n,"b",(function(){return o})),e.d(n,"a",(function(){return u})),e.d(n,"d",(function(){return f})),e.d(n,"c",(function(){return a})),e.d(n,"e",(function(){return i}));var r=Object.prototype.hasOwnProperty;function o(t,n){return r.call(t,n)}function u(t,n){var e,r;if(null!=n)for(e in n)r=n[e],"__proto__"!==e&&t!==r&&o(n,e)&&(t[e]=r)}var i,c=Object.prototype.toString;function f(t){return"[object Object]"===c.call(t)}function a(t){return"[object Date]"===c.call(t)}i="undefined"!=typeof window?window:void 0!==t?t:null}).call(this,e(2))},function(t,n,e){"use strict";e.r(n),e.d(n,"isArrayLike",(function(){return o})),e.d(n,"isEmptyData",(function(){return u})),e.d(n,"extend",(function(){return i})),e.d(n,"cloneJSON",(function(){return c})),e.d(n,"tryParseJSON",(function(){return f}));var r=e(0);function o(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}function u(t){if(null==t)return!0;if("string"==typeof t)return""===t.trim();if(Array.isArray(t))return!t.length;if(Object(r.d)(t)){for(var n in t)if(Object(r.b)(t,n))return!1;return!0}return!1}function i(t){if(null==t)throw new Error("The target argument cannot be null or undefined");for(var n=arguments.length,e=0;++e<n;)Object(r.a)(t,arguments[e]);return t}function c(t){return null==t?t:JSON.parse(JSON.stringify(t))}function f(t){var n;try{n=JSON.parse(t)}catch(t){}return n}e.d(n,"hasOwnProp",(function(){return r.b}))},function(t,n){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":e(window))&&(r=window)}t.exports=r},,,,,,,,function(t,n,e){"use strict";e.r(n),e.d(n,"StorageWrap",(function(){return c})),e.d(n,"session",(function(){return f})),e.d(n,"local",(function(){return a}));var r=e(1);function o(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u,i,c=function(){function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this._storageType=n||{getItem:function(){return null},setItem:function(){},removeItem:function(){}}}var n,e,u;return n=t,(e=[{key:"get",value:function(t){return this._storageType.getItem(t)}},{key:"getAsJSON",value:function(t){return Object(r.tryParseJSON)(this.get(t))}},{key:"set",value:function(t,n){try{return this._storageType.setItem(t,n),!0}catch(t){return!1}}},{key:"setAsJSON",value:function(t,n){return this.set(t,JSON.stringify(n))}},{key:"remove",value:function(t){this._storageType.removeItem(t)}}])&&o(n.prototype,e),u&&o(n,u),t}();if("undefined"!=typeof window)try{u=window.sessionStorage,i=window.localStorage}catch(t){}var f=new c(u),a=new c(i)}]);
|
package/dist/string.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(n){var t={};function r(e){if(t[e])return t[e].exports;var u=t[e]={i:e,l:!1,exports:{}};return n[e].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var u in n)r.d(e,u,function(t){return n[t]}.bind(null,u));return e},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=11)}([function(n,t,r){"use strict";(function(n){r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return o})),r.d(t,"d",(function(){return f})),r.d(t,"c",(function(){return l})),r.d(t,"e",(function(){return i}));var e=Object.prototype.hasOwnProperty;function u(n,t){return e.call(n,t)}function o(n,t){var r,e;if(null!=t)for(r in t)e=t[r],"__proto__"!==r&&n!==e&&u(t,r)&&(n[r]=e)}var i,c=Object.prototype.toString;function f(n){return"[object Object]"===c.call(n)}function l(n){return"[object Date]"===c.call(n)}i="undefined"!=typeof window?window:void 0!==n?n:null}).call(this,r(2))},function(n,t,r){"use strict";r.r(t),r.d(t,"isArrayLike",(function(){return u})),r.d(t,"isEmptyData",(function(){return o})),r.d(t,"extend",(function(){return i})),r.d(t,"cloneJSON",(function(){return c})),r.d(t,"tryParseJSON",(function(){return f}));var e=r(0);function u(n){return null!=n&&"function"!=typeof n&&"number"==typeof n.length&&n.length>=0&&n.length%1==0}function o(n){if(null==n)return!0;if("string"==typeof n)return""===n.trim();if(Array.isArray(n))return!n.length;if(Object(e.d)(n)){for(var t in n)if(Object(e.b)(n,t))return!1;return!0}return!1}function i(n){if(null==n)throw new Error("The target argument cannot be null or undefined");for(var t=arguments.length,r=0;++r<t;)Object(e.a)(n,arguments[r]);return n}function c(n){return null==n?n:JSON.parse(JSON.stringify(n))}function f(n){var t;try{t=JSON.parse(n)}catch(n){}return t}r.d(t,"hasOwnProp",(function(){return e.b}))},function(n,t){function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(n){"object"===("undefined"==typeof window?"undefined":r(window))&&(e=window)}n.exports=e},,,,,,,,,function(n,t,r){"use strict";r.r(t),r.d(t,"strLen",(function(){return u})),r.d(t,"cutStr",(function(){return o})),r.d(t,"escapeHTML",(function(){return i})),r.d(t,"removeTags",(function(){return c})),r.d(t,"nl2br",(function(){return f}));var e=r(1);function u(n,t){t=Number(t)||2;for(var r=0,e=n.length-1;e>=0;e--)r+=n.charCodeAt(e)>255?t:1;return r}function o(n,t,r){(r=Object(e.extend)({ellipsis:"..."},r)).mode=Math.max(Number(r.mode)||2,1);var o=u(n=String(n),r.mode);if(o<=t)return n;t-=u(r.ellipsis,r.mode);for(var i="",c=-1;t>0&&++c<o;)(t-=n.charCodeAt(c)>255?r.mode:1)>=0&&(i+=n.charAt(c));return i+=r.ellipsis}function i(n){if(null==n)return n;var t={'"':""","'":"'","&":"&","<":"<",">":">"};return String(n).replace(/["'&<>]/g,(function(n){return t[n]}))}function c(n){return null==n?n:String(n).replace(/<.+?>/g,"")}function f(n){return null==n?n:String(n).replace(/\r?\n/g,"<br />")}}]);
|
package/dist/validate.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var u=t[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)r.d(n,u,function(t){return e[t]}.bind(null,u));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=12)}({12:function(e,t,r){"use strict";function n(e){return/^1[3-9]\d{9}$/.test(e)}function u(e){var t=/^[\w-]+(?:\.[\w-]+)*@[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,}$/.test(e);if(t){for(var r=(t=e.replace("@",".").split(".")).length-1;r>=0;r--)if(/^[-_]/.test(t[r])||/[_-]$/.test(t[r]))return!1;return!0}return!1}r.r(t),r.d(t,"isPhoneNO",(function(){return n})),r.d(t,"isEmail",(function(){return u}))}});
|
package/src/boolean.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 本模块提供布尔值处理相关方法。
|
|
3
|
-
* @module boolean
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 布尔值转换为 Y 或者 N。
|
|
8
|
-
* @author tanyuqin
|
|
9
|
-
* @param {boolean} value 布尔值。
|
|
10
|
-
* @return {string} Y 或者 N。
|
|
11
|
-
*/
|
|
12
|
-
export function boolToYN(value) {
|
|
13
|
-
if (typeof value !== 'boolean') {
|
|
14
|
-
throw new Error('The value argument must be a boolean type');
|
|
15
|
-
}
|
|
16
|
-
return value ? 'Y' : 'N';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Y 或者 N 转换为布尔值。
|
|
21
|
-
* @author tanyuqin
|
|
22
|
-
* @param {string} value Y 或者 N。
|
|
23
|
-
* @return {boolean} 布尔值。
|
|
24
|
-
*/
|
|
25
|
-
export function ynToBool(value) {
|
|
26
|
-
value = String(value).toUpperCase();
|
|
27
|
-
if (value !== 'Y' && value !== 'N') {
|
|
28
|
-
throw new Error('The value argument must be "Y" or "N"');
|
|
29
|
-
}
|
|
30
|
-
return value === 'Y';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 检查指定数组元素的值是否都为 Y。
|
|
35
|
-
* @param {Array} values 指定数组。
|
|
36
|
-
* @return 指定数组元素的值是否都为 Y。
|
|
37
|
-
*/
|
|
38
|
-
export function allY(values) { return values.every(ynToBool); }
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 检查指定数组元素的值是否至少有一个为 Y。
|
|
42
|
-
* @param {Array} values 指定数组。
|
|
43
|
-
* @return 指定数组元素的值是否至少有一个为 Y。
|
|
44
|
-
*/
|
|
45
|
-
export function someY(values) { return values.some(ynToBool); }
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 检查指定数组元素的值是否都为 N。
|
|
49
|
-
* @param {Array} values 指定数组。
|
|
50
|
-
* @return 指定数组元素的值是否都为 N。
|
|
51
|
-
*/
|
|
52
|
-
export function allN(values) {
|
|
53
|
-
return values.every(function(value) {
|
|
54
|
-
return !ynToBool(value);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 检查指定数组元素的值是否至少有一个为 N。
|
|
60
|
-
* @param {Array} values 指定数组。
|
|
61
|
-
* @return 指定数组元素的值是否至少有一个为 N。
|
|
62
|
-
*/
|
|
63
|
-
export function someN(values) {
|
|
64
|
-
return values.some(function(value) {
|
|
65
|
-
return !ynToBool(value);
|
|
66
|
-
});
|
|
67
|
-
}
|
package/src/browser.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 本模块提供浏览器检测相关方法。
|
|
3
|
-
* @module browser
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// 默认获取浏览器 useragent
|
|
7
|
-
function getBrowserUA(ua) {
|
|
8
|
-
if (!ua && typeof navigator !== 'undefined') {
|
|
9
|
-
ua = navigator.userAgent;
|
|
10
|
-
}
|
|
11
|
-
return ua;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 检查指定 useragent 字符串是否符合移动端设备特征。
|
|
16
|
-
* @author luoliquan
|
|
17
|
-
* @param {string} [ua] useragent 字符串,浏览器环境下默认为 navigator.userAgent。
|
|
18
|
-
* @return {boolean} 是否符合移动端设备特征。
|
|
19
|
-
*/
|
|
20
|
-
export function isMobile(ua) {
|
|
21
|
-
ua = getBrowserUA(ua);
|
|
22
|
-
return /mobile|android/i.test(ua) || !/\b(Windows\sNT|Macintosh|Linux)\b/.test(ua);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 检查指定 useragent 字符串是否符合微信客户端特征。
|
|
27
|
-
* @author luoliquan
|
|
28
|
-
* @param {string} [ua] useragent 字符串,浏览器环境下默认为 navigator.userAgent。
|
|
29
|
-
* @return {boolean} 是否符合微信客户端特征。
|
|
30
|
-
*/
|
|
31
|
-
export function isWeixin(ua) {
|
|
32
|
-
ua = getBrowserUA(ua);
|
|
33
|
-
return /\bMicroMessenger\//.test(ua);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 检查指定 useragent 字符串是否符合企业微信客户端特征。
|
|
38
|
-
* @author luoliquan
|
|
39
|
-
* @param {string} [ua] useragent 字符串,浏览器环境下默认为 navigator.userAgent。
|
|
40
|
-
* @return {boolean} 字符串是否符合企业微信客户端特征。
|
|
41
|
-
*/
|
|
42
|
-
export function isWorkWeixin(ua) {
|
|
43
|
-
ua = getBrowserUA(ua);
|
|
44
|
-
return isWeixin(ua) && /\bwxwork\b/.test(ua);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 获取指定 useragent 字符串中的 IE 浏览器版本号。
|
|
49
|
-
* @author luoliquan
|
|
50
|
-
* @param {string} [ua] useragent 字符串,浏览器环境下默认为 navigator.userAgent。
|
|
51
|
-
* @return {(boolean|string)} IE 浏览器版本号,不符合该浏览器特征时返回 false。
|
|
52
|
-
*/
|
|
53
|
-
export function ieVersion(ua) {
|
|
54
|
-
ua = getBrowserUA(ua);
|
|
55
|
-
if (/\bMSIE\s(\d+)/i.test(ua) || /\bTrident\/.*;\srv:(\d+)/.test(ua)) {
|
|
56
|
-
return RegExp.$1;
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 检查指定 useragent 字符串是否符合安卓系统特征。
|
|
63
|
-
* @author luoliquan
|
|
64
|
-
* @param {string} [ua] useragent 字符串,浏览器环境下默认为 navigator.userAgent。
|
|
65
|
-
* @return {boolean} 是否符合安卓系统特征。
|
|
66
|
-
*/
|
|
67
|
-
export function isAndroid(ua) {
|
|
68
|
-
ua = getBrowserUA(ua);
|
|
69
|
-
return /\b(?:Android|Adr)\b/.test(ua);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 检查指定 useragent 字符串是否符合 iOS 系统特征。
|
|
74
|
-
* @author luoliquan
|
|
75
|
-
* @param {string} [ua] useragent 字符串,浏览器环境下默认为 navigator.userAgent。
|
|
76
|
-
* @return {boolean} 是否符合 iOS 系统特征。
|
|
77
|
-
*/
|
|
78
|
-
export function isIOS(ua) {
|
|
79
|
-
ua = getBrowserUA(ua);
|
|
80
|
-
return /\b(?:iPad|iPod|iPhone)\b/.test(ua);
|
|
81
|
-
}
|