type-tls 3.0.0 → 3.1.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/LICENSE +21 -21
- package/README.md +86 -86
- package/dist/index.d.ts +1 -0
- package/dist/other.d.ts +25 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/type-tls.d.ts +27 -0
- package/dist/type-tls.iife.js +1 -1
- package/dist/type-tls.js +72 -55
- package/dist/type-tls.umd.cjs +1 -1
- package/doc/api/index.md +20 -3
- package/doc/api/type-tls.bitflagequaltesttype.getequalfun.md +52 -0
- package/doc/api/type-tls.bitflagequaltesttype.md +37 -0
- package/doc/api/type-tls.getexacttypenameof.md +30 -3
- package/doc/api/type-tls.getexacttypeof.md +30 -3
- package/doc/api/type-tls.getnameoftype.md +32 -3
- package/doc/api/type-tls.gettypebyname.md +32 -3
- package/doc/api/type-tls.gettypenameof.md +30 -3
- package/doc/api/type-tls.gettypeof.md +30 -3
- package/doc/api/type-tls.isanonymousfunction.md +30 -3
- package/doc/api/type-tls.isarraylike.md +32 -3
- package/doc/api/type-tls.isarrowfunction.md +32 -3
- package/doc/api/type-tls.isasyncfunction.md +32 -3
- package/doc/api/type-tls.isasyncgeneratorfunction.md +32 -3
- package/doc/api/type-tls.isbasetype.md +32 -3
- package/doc/api/type-tls.isgeneratorfunction.md +32 -3
- package/doc/api/type-tls.isidentifier.md +32 -3
- package/doc/api/type-tls.isiterable.md +32 -3
- package/doc/api/type-tls.isiterator.md +32 -3
- package/doc/api/type-tls.isobject.md +32 -3
- package/doc/api/type-tls.md +599 -52
- package/doc/api/type-tls.waitasyncable.md +46 -4
- package/doc//346/225/231/347/250/213.md +6 -6
- package/package.json +25 -17
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 郭斌勇
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 郭斌勇
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
[教程]: ./doc/教程.md
|
|
2
|
-
[API接口文档]: ./doc/api/index.md
|
|
3
|
-
|
|
4
|
-
[GitHub仓库]: https://github.com/GuoBinyong/type-tls
|
|
5
|
-
[发行地址]: https://github.com/GuoBinyong/type-tls/releases
|
|
6
|
-
[issues]: https://github.com/GuoBinyong/type-tls/issues
|
|
7
|
-
|
|
8
|
-
[码云仓库]: https://gitee.com/guobinyong/type-tls
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
> 目录
|
|
13
|
-
|
|
14
|
-
- [1. 简介](#1-简介)
|
|
15
|
-
- [2. 安装方式](#2-安装方式)
|
|
16
|
-
- [2.1. 方式1:通过 npm 安装](#21-方式1通过-npm-安装)
|
|
17
|
-
- [2.2. 方式3:通过`<script>`标签引入](#22-方式3通过script标签引入)
|
|
18
|
-
- [3. 教程](#3-教程)
|
|
19
|
-
- [4. API接口文档](#4-api接口文档)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# 1. 简介
|
|
25
|
-
在使用 TypeScript 封装库时,如果希望设计更智能的 TypeScript 类型推导,则往往需要大量的类型相关的操作,type-tls 就提供了常用的类型操作的工具,比如:获取数据的类型 或 类型名字、判断数据的类型、还有一些 Type 工具。
|
|
26
|
-
|
|
27
|
-
**详情请看:**
|
|
28
|
-
- 主页:<https://github.com/GuoBinyong/type-tls>
|
|
29
|
-
- [GitHub仓库][]
|
|
30
|
-
- [码云仓库][]
|
|
31
|
-
- [教程][]
|
|
32
|
-
- [API接口文档][]
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
**如果您在使用的过程中遇到了问题,或者有好的建议和想法,您都可以通过以下方式联系我,期待与您的交流:**
|
|
36
|
-
- 给该仓库提交 [issues][]
|
|
37
|
-
- 给我 Pull requests
|
|
38
|
-
- 邮箱:<guobinyong@qq.com>
|
|
39
|
-
- QQ:guobinyong@qq.com
|
|
40
|
-
- 微信:keyanzhe
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# 2. 安装方式
|
|
47
|
-
目前,安装方式有以下几种:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## 2.1. 方式1:通过 npm 安装
|
|
51
|
-
通过 npm (或 yarn、pnpm 等包管理器)安装
|
|
52
|
-
```
|
|
53
|
-
npm install type-tls
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## 2.2. 方式3:通过`<script>`标签引入
|
|
60
|
-
您可直接从项目的 [发行地址][] 中下载以 `.iife.js` 作为缀的文件,然后使用如下代码引用 和 使用 type-tls:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
1. 引用 type-tls
|
|
64
|
-
```
|
|
65
|
-
<script src="path/to/package/type-tls.iife.js"></script>
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
2. 使用全局的 `TypeTls`
|
|
69
|
-
```
|
|
70
|
-
<script>
|
|
71
|
-
// 使用全局的 TypeTls
|
|
72
|
-
</script>
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
# 3. 教程
|
|
76
|
-
详情跳转至[教程][]
|
|
77
|
-
|
|
78
|
-
# 4. API接口文档
|
|
79
|
-
详情跳转至[API接口文档][]
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
--------------------
|
|
84
|
-
|
|
85
|
-
> 有您的支持,我会在开源的道路上,越走越远
|
|
86
|
-
|
|
1
|
+
[教程]: ./doc/教程.md
|
|
2
|
+
[API接口文档]: ./doc/api/index.md
|
|
3
|
+
|
|
4
|
+
[GitHub仓库]: https://github.com/GuoBinyong/type-tls
|
|
5
|
+
[发行地址]: https://github.com/GuoBinyong/type-tls/releases
|
|
6
|
+
[issues]: https://github.com/GuoBinyong/type-tls/issues
|
|
7
|
+
|
|
8
|
+
[码云仓库]: https://gitee.com/guobinyong/type-tls
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
> 目录
|
|
13
|
+
|
|
14
|
+
- [1. 简介](#1-简介)
|
|
15
|
+
- [2. 安装方式](#2-安装方式)
|
|
16
|
+
- [2.1. 方式1:通过 npm 安装](#21-方式1通过-npm-安装)
|
|
17
|
+
- [2.2. 方式3:通过`<script>`标签引入](#22-方式3通过script标签引入)
|
|
18
|
+
- [3. 教程](#3-教程)
|
|
19
|
+
- [4. API接口文档](#4-api接口文档)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# 1. 简介
|
|
25
|
+
在使用 TypeScript 封装库时,如果希望设计更智能的 TypeScript 类型推导,则往往需要大量的类型相关的操作,type-tls 就提供了常用的类型操作的工具,比如:获取数据的类型 或 类型名字、判断数据的类型、还有一些 Type 工具。
|
|
26
|
+
|
|
27
|
+
**详情请看:**
|
|
28
|
+
- 主页:<https://github.com/GuoBinyong/type-tls>
|
|
29
|
+
- [GitHub仓库][]
|
|
30
|
+
- [码云仓库][]
|
|
31
|
+
- [教程][]
|
|
32
|
+
- [API接口文档][]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
**如果您在使用的过程中遇到了问题,或者有好的建议和想法,您都可以通过以下方式联系我,期待与您的交流:**
|
|
36
|
+
- 给该仓库提交 [issues][]
|
|
37
|
+
- 给我 Pull requests
|
|
38
|
+
- 邮箱:<guobinyong@qq.com>
|
|
39
|
+
- QQ:guobinyong@qq.com
|
|
40
|
+
- 微信:keyanzhe
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# 2. 安装方式
|
|
47
|
+
目前,安装方式有以下几种:
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 2.1. 方式1:通过 npm 安装
|
|
51
|
+
通过 npm (或 yarn、pnpm 等包管理器)安装
|
|
52
|
+
```
|
|
53
|
+
npm install type-tls
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## 2.2. 方式3:通过`<script>`标签引入
|
|
60
|
+
您可直接从项目的 [发行地址][] 中下载以 `.iife.js` 作为缀的文件,然后使用如下代码引用 和 使用 type-tls:
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
1. 引用 type-tls
|
|
64
|
+
```
|
|
65
|
+
<script src="path/to/package/type-tls.iife.js"></script>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. 使用全局的 `TypeTls`
|
|
69
|
+
```
|
|
70
|
+
<script>
|
|
71
|
+
// 使用全局的 TypeTls
|
|
72
|
+
</script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
# 3. 教程
|
|
76
|
+
详情跳转至[教程][]
|
|
77
|
+
|
|
78
|
+
# 4. API接口文档
|
|
79
|
+
详情跳转至[API接口文档][]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
--------------------
|
|
84
|
+
|
|
85
|
+
> 有您的支持,我会在开源的道路上,越走越远
|
|
86
|
+
|
|
87
87
|

|
package/dist/index.d.ts
CHANGED
package/dist/other.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 位标志相等测试
|
|
3
|
+
*/
|
|
4
|
+
export declare enum BitFlagEqualTestType {
|
|
5
|
+
/**
|
|
6
|
+
* 相等:A === B
|
|
7
|
+
*/
|
|
8
|
+
equal = "equal",// "相等"
|
|
9
|
+
/**
|
|
10
|
+
* 相交:A & B
|
|
11
|
+
*/
|
|
12
|
+
intersect = "intersect",// "相交"
|
|
13
|
+
/**
|
|
14
|
+
* 交等:A & B === A
|
|
15
|
+
*/
|
|
16
|
+
intersectEqual = "intersectEqual"
|
|
17
|
+
}
|
|
18
|
+
export declare namespace BitFlagEqualTestType {
|
|
19
|
+
/**
|
|
20
|
+
* 获取 位标志相等测试的函数
|
|
21
|
+
* @param testType
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
function getEqualFun(testType: BitFlagEqualTestType): (a: number, b: number) => number | boolean;
|
|
25
|
+
}
|
package/dist/tsdoc-metadata.json
CHANGED
package/dist/type-tls.d.ts
CHANGED
|
@@ -9,6 +9,33 @@ export declare type AnyFunction = (...args: any) => any;
|
|
|
9
9
|
*/
|
|
10
10
|
export declare type ArrayItemType<Arr> = Arr extends (infer Item)[] ? Item : never;
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* 位标志相等测试
|
|
14
|
+
*/
|
|
15
|
+
export declare enum BitFlagEqualTestType {
|
|
16
|
+
/**
|
|
17
|
+
* 相等:A === B
|
|
18
|
+
*/
|
|
19
|
+
equal = "equal",// "相等"
|
|
20
|
+
/**
|
|
21
|
+
* 相交:A & B
|
|
22
|
+
*/
|
|
23
|
+
intersect = "intersect",// "相交"
|
|
24
|
+
/**
|
|
25
|
+
* 交等:A & B === A
|
|
26
|
+
*/
|
|
27
|
+
intersectEqual = "intersectEqual"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare namespace BitFlagEqualTestType {
|
|
31
|
+
/**
|
|
32
|
+
* 获取 位标志相等测试的函数
|
|
33
|
+
* @param testType
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export function getEqualFun(testType: BitFlagEqualTestType): (a: number, b: number) => number | boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
12
39
|
/**
|
|
13
40
|
* 精确类型
|
|
14
41
|
*
|
package/dist/type-tls.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var TypeTls=function(e){"use strict";function
|
|
1
|
+
var TypeTls=function(e){"use strict";function f(n){var t=typeof n;return n&&(t==="object"||t==="function")}function o(n){var t=n;return n!=null&&(t=n.constructor,t==null&&(t=typeof n)),t}function s(n){switch(n){case void 0:return"undefined";case null:return"null"}let t=typeof n;switch(t){case"function":return n.name;case"string":return n;default:return t}}function y(n){return globalThis[n]}function l(n){let t=o(n);return s(t)}function a(n){return n==null||f(n)?o(n):typeof n}function g(n){var t=a(n);return s(t)}function T(n){var t=typeof n;return n==null||t!=="object"&&t!=="function"}function F(n){let t=n&&n.length;return Number.isInteger(n.length)&&t>=0}function A(n){return n&&typeof n[Symbol.iterator]=="function"}function b(n){return n&&typeof n.next=="function"}const m=/^[A-Za-z_$]+[\w$]*$/;function O(n){return m.test(n)}const d=/(^\s*(async\s+)?\s*(\b[A-Za-z_$]+[\w$]*\b)\s*=>)|(^\s*(async\s+)?\s*\(\s*(\b[A-Za-z_$]+[\w$]*\b)?\s*(,\s*(\b[A-Za-z_$]+[\w$]*\b)\s*)*\)\s*=>)/;function w(n){const t=n.toString();return d.test(t)}const h=globalThis.AsyncFunction??(async function(){}).constructor;function v(n){return n instanceof h}const E=globalThis.GeneratorFunction??(function*(){}).constructor;function $(n){return n instanceof E}const N=globalThis.AsyncGeneratorFunction??(async function*(){}).constructor;function S(n){return n instanceof N}const q=/(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;function I(n){if(n.name){const t=n.toString();return!q.test(t)}return!0}function G(n,t){return n instanceof Promise?n.then(i=>t(i,!1,void 0),i=>t(void 0,!0,i)):t(n,!1,void 0)}return e.BitFlagEqualTestType=(n=>(n.equal="equal",n.intersect="intersect",n.intersectEqual="intersectEqual",n))(e.BitFlagEqualTestType||{}),(n=>{function t(i){let c;switch(i){case"equal":c=(u,r)=>u===r;case"intersect":c=(u,r)=>u&r;default:c=(u,r)=>(u&r)===u}return c}n.getEqualFun=t})(e.BitFlagEqualTestType||(e.BitFlagEqualTestType={})),e.getExactTypeNameOf=g,e.getExactTypeOf=a,e.getNameOfType=s,e.getTypeByName=y,e.getTypeNameOf=l,e.getTypeOf=o,e.isAnonymousFunction=I,e.isArrayLike=F,e.isArrowFunction=w,e.isAsyncFunction=v,e.isAsyncGeneratorFunction=S,e.isBaseType=T,e.isGeneratorFunction=$,e.isIdentifier=O,e.isIterable=A,e.isIterator=b,e.isObject=f,e.waitAsyncable=G,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
package/dist/type-tls.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(n) {
|
|
2
2
|
var t = typeof n;
|
|
3
3
|
return n && (t === "object" || t === "function");
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function i(n) {
|
|
6
6
|
var t = n;
|
|
7
7
|
return n != null && (t = n.constructor, t == null && (t = typeof n)), t;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function s(n) {
|
|
10
10
|
switch (n) {
|
|
11
11
|
case void 0:
|
|
12
12
|
return "undefined";
|
|
@@ -23,86 +23,103 @@ function o(n) {
|
|
|
23
23
|
return t;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function b(n) {
|
|
27
27
|
return globalThis[n];
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
let t =
|
|
31
|
-
return
|
|
29
|
+
function h(n) {
|
|
30
|
+
let t = i(n);
|
|
31
|
+
return s(t);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return n == null ||
|
|
33
|
+
function a(n) {
|
|
34
|
+
return n == null || f(n) ? i(n) : typeof n;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
var t =
|
|
38
|
-
return
|
|
36
|
+
function m(n) {
|
|
37
|
+
var t = a(n);
|
|
38
|
+
return s(t);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function w(n) {
|
|
41
41
|
var t = typeof n;
|
|
42
42
|
return n == null || t !== "object" && t !== "function";
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function $(n) {
|
|
45
45
|
let t = n && n.length;
|
|
46
46
|
return Number.isInteger(n.length) && t >= 0;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function d(n) {
|
|
49
49
|
return n && typeof n[Symbol.iterator] == "function";
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function v(n) {
|
|
52
52
|
return n && typeof n.next == "function";
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
return
|
|
54
|
+
const l = /^[A-Za-z_$]+[\w$]*$/;
|
|
55
|
+
function T(n) {
|
|
56
|
+
return l.test(n);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
function
|
|
58
|
+
const y = /(^\s*(async\s+)?\s*(\b[A-Za-z_$]+[\w$]*\b)\s*=>)|(^\s*(async\s+)?\s*\(\s*(\b[A-Za-z_$]+[\w$]*\b)?\s*(,\s*(\b[A-Za-z_$]+[\w$]*\b)\s*)*\)\s*=>)/;
|
|
59
|
+
function O(n) {
|
|
60
60
|
const t = n.toString();
|
|
61
|
-
return
|
|
61
|
+
return y.test(t);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const p = globalThis.AsyncFunction ?? (async function() {
|
|
64
64
|
}).constructor;
|
|
65
|
-
function
|
|
66
|
-
return n instanceof
|
|
65
|
+
function S(n) {
|
|
66
|
+
return n instanceof p;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const g = globalThis.GeneratorFunction ?? (function* () {
|
|
69
69
|
}).constructor;
|
|
70
|
-
function
|
|
71
|
-
return n instanceof
|
|
70
|
+
function q(n) {
|
|
71
|
+
return n instanceof g;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const A = globalThis.AsyncGeneratorFunction ?? (async function* () {
|
|
74
74
|
}).constructor;
|
|
75
|
-
function
|
|
76
|
-
return n instanceof
|
|
75
|
+
function x(n) {
|
|
76
|
+
return n instanceof A;
|
|
77
77
|
}
|
|
78
|
-
const
|
|
79
|
-
function
|
|
78
|
+
const F = /(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;
|
|
79
|
+
function E(n) {
|
|
80
80
|
if (n.name) {
|
|
81
81
|
const t = n.toString();
|
|
82
|
-
return !
|
|
82
|
+
return !F.test(t);
|
|
83
83
|
}
|
|
84
84
|
return !0;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
return n instanceof Promise ? n.then((
|
|
88
|
-
}
|
|
86
|
+
function G(n, t) {
|
|
87
|
+
return n instanceof Promise ? n.then((r) => t(r, !1, void 0), (r) => t(void 0, !0, r)) : t(n, !1, void 0);
|
|
88
|
+
}
|
|
89
|
+
var c = /* @__PURE__ */ ((n) => (n.equal = "equal", n.intersect = "intersect", n.intersectEqual = "intersectEqual", n))(c || {});
|
|
90
|
+
((n) => {
|
|
91
|
+
function t(r) {
|
|
92
|
+
let o;
|
|
93
|
+
switch (r) {
|
|
94
|
+
case "equal":
|
|
95
|
+
o = (e, u) => e === u;
|
|
96
|
+
case "intersect":
|
|
97
|
+
o = (e, u) => e & u;
|
|
98
|
+
default:
|
|
99
|
+
o = (e, u) => (e & u) === e;
|
|
100
|
+
}
|
|
101
|
+
return o;
|
|
102
|
+
}
|
|
103
|
+
n.getEqualFun = t;
|
|
104
|
+
})(c || (c = {}));
|
|
89
105
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
T as
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
c as BitFlagEqualTestType,
|
|
107
|
+
m as getExactTypeNameOf,
|
|
108
|
+
a as getExactTypeOf,
|
|
109
|
+
s as getNameOfType,
|
|
110
|
+
b as getTypeByName,
|
|
111
|
+
h as getTypeNameOf,
|
|
112
|
+
i as getTypeOf,
|
|
113
|
+
E as isAnonymousFunction,
|
|
114
|
+
$ as isArrayLike,
|
|
115
|
+
O as isArrowFunction,
|
|
116
|
+
S as isAsyncFunction,
|
|
117
|
+
x as isAsyncGeneratorFunction,
|
|
118
|
+
w as isBaseType,
|
|
119
|
+
q as isGeneratorFunction,
|
|
120
|
+
T as isIdentifier,
|
|
121
|
+
d as isIterable,
|
|
122
|
+
v as isIterator,
|
|
123
|
+
f as isObject,
|
|
124
|
+
G as waitAsyncable
|
|
108
125
|
};
|
package/dist/type-tls.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(t,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(t=typeof globalThis<"u"?globalThis:t||self,i(t.TypeTls={}))})(this,function(t){"use strict";function i(n){var e=typeof n;return n&&(e==="object"||e==="function")}function s(n){var e=n;return n!=null&&(e=n.constructor,e==null&&(e=typeof n)),e}function f(n){switch(n){case void 0:return"undefined";case null:return"null"}let e=typeof n;switch(e){case"function":return n.name;case"string":return n;default:return e}}function y(n){return globalThis[n]}function l(n){let e=s(n);return f(e)}function a(n){return n==null||i(n)?s(n):typeof n}function g(n){var e=a(n);return f(e)}function T(n){var e=typeof n;return n==null||e!=="object"&&e!=="function"}function d(n){let e=n&&n.length;return Number.isInteger(n.length)&&e>=0}function F(n){return n&&typeof n[Symbol.iterator]=="function"}function A(n){return n&&typeof n.next=="function"}const b=/^[A-Za-z_$]+[\w$]*$/;function m(n){return b.test(n)}const p=/(^\s*(async\s+)?\s*(\b[A-Za-z_$]+[\w$]*\b)\s*=>)|(^\s*(async\s+)?\s*\(\s*(\b[A-Za-z_$]+[\w$]*\b)?\s*(,\s*(\b[A-Za-z_$]+[\w$]*\b)\s*)*\)\s*=>)/;function O(n){const e=n.toString();return p.test(e)}const h=globalThis.AsyncFunction??(async function(){}).constructor;function w(n){return n instanceof h}const E=globalThis.GeneratorFunction??(function*(){}).constructor;function $(n){return n instanceof E}const v=globalThis.AsyncGeneratorFunction??(async function*(){}).constructor;function N(n){return n instanceof v}const S=/(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;function q(n){if(n.name){const e=n.toString();return!S.test(e)}return!0}function I(n,e){return n instanceof Promise?n.then(r=>e(r,!1,void 0),r=>e(void 0,!0,r)):e(n,!1,void 0)}t.BitFlagEqualTestType=(n=>(n.equal="equal",n.intersect="intersect",n.intersectEqual="intersectEqual",n))(t.BitFlagEqualTestType||{}),(n=>{function e(r){let o;switch(r){case"equal":o=(u,c)=>u===c;case"intersect":o=(u,c)=>u&c;default:o=(u,c)=>(u&c)===u}return o}n.getEqualFun=e})(t.BitFlagEqualTestType||(t.BitFlagEqualTestType={})),t.getExactTypeNameOf=g,t.getExactTypeOf=a,t.getNameOfType=f,t.getTypeByName=y,t.getTypeNameOf=l,t.getTypeOf=s,t.isAnonymousFunction=q,t.isArrayLike=d,t.isArrowFunction=O,t.isAsyncFunction=w,t.isAsyncGeneratorFunction=N,t.isBaseType=T,t.isGeneratorFunction=$,t.isIdentifier=m,t.isIterable=F,t.isIterator=A,t.isObject=i,t.waitAsyncable=I,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/doc/api/index.md
CHANGED
|
@@ -6,7 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
## Packages
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| [type-tls](./type-tls.md) | |
|
|
9
|
+
<table><thead><tr><th>
|
|
12
10
|
|
|
11
|
+
Package
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
</th><th>
|
|
15
|
+
|
|
16
|
+
Description
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
</th></tr></thead>
|
|
20
|
+
<tbody><tr><td>
|
|
21
|
+
|
|
22
|
+
[type-tls](./type-tls.md)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</td><td>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</td></tr>
|
|
29
|
+
</tbody></table>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [type-tls](./type-tls.md) > [BitFlagEqualTestType](./type-tls.bitflagequaltesttype.md) > [getEqualFun](./type-tls.bitflagequaltesttype.getequalfun.md)
|
|
4
|
+
|
|
5
|
+
## BitFlagEqualTestType.getEqualFun() function
|
|
6
|
+
|
|
7
|
+
获取 位标志相等测试的函数
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
function getEqualFun(testType: BitFlagEqualTestType): (a: number, b: number) => number | boolean;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
testType
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
[BitFlagEqualTestType](./type-tls.bitflagequaltesttype.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td></tr>
|
|
47
|
+
</tbody></table>
|
|
48
|
+
**Returns:**
|
|
49
|
+
|
|
50
|
+
(a: number, b: number) => number \| boolean
|
|
51
|
+
|
|
52
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [type-tls](./type-tls.md) > [BitFlagEqualTestType](./type-tls.bitflagequaltesttype.md)
|
|
4
|
+
|
|
5
|
+
## BitFlagEqualTestType namespace
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export declare namespace BitFlagEqualTestType
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Functions
|
|
14
|
+
|
|
15
|
+
<table><thead><tr><th>
|
|
16
|
+
|
|
17
|
+
Function
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
</th><th>
|
|
21
|
+
|
|
22
|
+
Description
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</th></tr></thead>
|
|
26
|
+
<tbody><tr><td>
|
|
27
|
+
|
|
28
|
+
[getEqualFun(testType)](./type-tls.bitflagequaltesttype.getequalfun.md)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
</td><td>
|
|
32
|
+
|
|
33
|
+
获取 位标志相等测试的函数
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
</td></tr>
|
|
37
|
+
</tbody></table>
|
|
@@ -14,10 +14,37 @@ export declare function getExactTypeNameOf(inst: any): ExactTypeName;
|
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| inst | any | |
|
|
17
|
+
<table><thead><tr><th>
|
|
20
18
|
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
inst
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
any
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td></tr>
|
|
47
|
+
</tbody></table>
|
|
21
48
|
**Returns:**
|
|
22
49
|
|
|
23
50
|
[ExactTypeName](./type-tls.exacttypename.md)
|