type-tls 3.10.0 → 3.12.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/dist/async.d.ts +6 -0
- package/dist/base.d.ts +1 -1
- package/dist/index.iife.js +1 -0
- package/dist/index.js +125 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/member.d.ts +16 -1
- package/package.json +9 -8
- package/dist/type-tls.iife.js +0 -1
- package/dist/type-tls.js +0 -147
- package/dist/type-tls.umd.cjs +0 -1
package/dist/async.d.ts
CHANGED
package/dist/base.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var TypeTls=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){var t=typeof e;return e&&(t===`object`||t===`function`)}function n(e){var t=e;return e!=null&&(t=e.constructor,t??=typeof e),t}function r(e){switch(e){case void 0:return`undefined`;case null:return`null`}let t=typeof e;switch(t){case`function`:return e.name;case`string`:return e;default:return t}}function i(e){return globalThis[e]}function a(e){return r(n(e))}function o(e){return e==null||t(e)?n(e):typeof e}function s(e){return r(o(e))}function c(e){var t=typeof e;return e==null||t!==`object`&&t!==`function`}function l(e){let t=e&&e.length;return Number.isInteger(e.length)&&t>=0}function u(e){return e&&typeof e[Symbol.iterator]==`function`}function d(e){return e&&typeof e.next==`function`}function f(e){return e==null?!0:typeof e==`string`?e===``||e.trim()===``:!1}function p(e){return e==null?!0:typeof e==`object`?l(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:Reflect.ownKeys(e).length===0:!1}function m(e){return typeof e==`object`?p(e):f(e)}var h=/^[A-Za-z_$]+[\w$]*$/;function g(e){return h.test(e)}var _=/(^\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 v(e){let t=e.toString();return _.test(t)}var y=globalThis.AsyncFunction??async function(){}.constructor;function b(e){return e instanceof y}var x=globalThis.GeneratorFunction??function*(){}.constructor;function S(e){return e instanceof x}var C=globalThis.AsyncGeneratorFunction??async function*(){}.constructor;function w(e){return e instanceof C}var T=/(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;function E(e){if(e.name){let t=e.toString();return!T.test(t)}return!0}function D(e){return Array.isArray(e)?e:e==null?[]:[e]}function O(e){for(let[t,n]of Object.entries(e))e[t]=Array.isArray(n)?n:n==null?[]:[n];return e}function k(){return function(e){return e}}function A(e,t){return e instanceof Promise?e.then(e=>t(e,!1,void 0),e=>t(void 0,!0,e)):t(e,!1,void 0)}var j=function(e){return e.equal=`equal`,e.intersect=`intersect`,e.intersectEqual=`intersectEqual`,e}({});return(function(e){function t(e){let t;switch(e){case j.equal:t=((e,t)=>e===t);case j.intersect:t=((e,t)=>e&t);default:t=((e,t)=>(e&t)===e)}return t}e.getEqualFun=t})(j||={}),Object.defineProperty(e,`BitFlagEqualTestType`,{enumerable:!0,get:function(){return j}}),e.formatAsArray=D,e.formatMemberAsArray=O,e.getExactTypeNameOf=s,e.getExactTypeOf=o,e.getNameOfType=r,e.getTypeByName=i,e.getTypeNameOf=a,e.getTypeOf=n,e.isAnonymousFunction=E,e.isArrayLike=l,e.isArrowFunction=v,e.isAsyncFunction=b,e.isAsyncGeneratorFunction=w,e.isBaseType=c,e.isEmptyObject=p,e.isEmptyValue=m,e.isEmptyValue_Base=f,e.isGeneratorFunction=S,e.isIdentifier=g,e.isIterable=u,e.isIterator=d,e.isObject=t,e.patchType=k,e.waitAsyncable=A,e})({});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//#region src/base.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
var t = typeof e;
|
|
4
|
+
return e && (t === "object" || t === "function");
|
|
5
|
+
}
|
|
6
|
+
function t(e) {
|
|
7
|
+
var t = e;
|
|
8
|
+
return e != null && (t = e.constructor, t ??= typeof e), t;
|
|
9
|
+
}
|
|
10
|
+
function n(e) {
|
|
11
|
+
switch (e) {
|
|
12
|
+
case void 0: return "undefined";
|
|
13
|
+
case null: return "null";
|
|
14
|
+
}
|
|
15
|
+
let t = typeof e;
|
|
16
|
+
switch (t) {
|
|
17
|
+
case "function": return e.name;
|
|
18
|
+
case "string": return e;
|
|
19
|
+
default: return t;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function r(e) {
|
|
23
|
+
return globalThis[e];
|
|
24
|
+
}
|
|
25
|
+
function i(e) {
|
|
26
|
+
return n(t(e));
|
|
27
|
+
}
|
|
28
|
+
function a(n) {
|
|
29
|
+
return n == null || e(n) ? t(n) : typeof n;
|
|
30
|
+
}
|
|
31
|
+
function o(e) {
|
|
32
|
+
return n(a(e));
|
|
33
|
+
}
|
|
34
|
+
function s(e) {
|
|
35
|
+
var t = typeof e;
|
|
36
|
+
return e == null || t !== "object" && t !== "function";
|
|
37
|
+
}
|
|
38
|
+
function c(e) {
|
|
39
|
+
let t = e && e.length;
|
|
40
|
+
return Number.isInteger(e.length) && t >= 0;
|
|
41
|
+
}
|
|
42
|
+
function l(e) {
|
|
43
|
+
return e && typeof e[Symbol.iterator] == "function";
|
|
44
|
+
}
|
|
45
|
+
function u(e) {
|
|
46
|
+
return e && typeof e.next == "function";
|
|
47
|
+
}
|
|
48
|
+
function d(e) {
|
|
49
|
+
return e == null ? !0 : typeof e == "string" ? e === "" || e.trim() === "" : !1;
|
|
50
|
+
}
|
|
51
|
+
function f(e) {
|
|
52
|
+
return e == null ? !0 : typeof e == "object" ? c(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : Reflect.ownKeys(e).length === 0 : !1;
|
|
53
|
+
}
|
|
54
|
+
function p(e) {
|
|
55
|
+
return typeof e == "object" ? f(e) : d(e);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/function.ts
|
|
59
|
+
var m = /^[A-Za-z_$]+[\w$]*$/;
|
|
60
|
+
function h(e) {
|
|
61
|
+
return m.test(e);
|
|
62
|
+
}
|
|
63
|
+
var g = /(^\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*=>)/;
|
|
64
|
+
function _(e) {
|
|
65
|
+
let t = e.toString();
|
|
66
|
+
return g.test(t);
|
|
67
|
+
}
|
|
68
|
+
var v = globalThis.AsyncFunction ?? async function() {}.constructor;
|
|
69
|
+
function y(e) {
|
|
70
|
+
return e instanceof v;
|
|
71
|
+
}
|
|
72
|
+
var b = globalThis.GeneratorFunction ?? function* () {}.constructor;
|
|
73
|
+
function x(e) {
|
|
74
|
+
return e instanceof b;
|
|
75
|
+
}
|
|
76
|
+
var S = globalThis.AsyncGeneratorFunction ?? async function* () {}.constructor;
|
|
77
|
+
function C(e) {
|
|
78
|
+
return e instanceof S;
|
|
79
|
+
}
|
|
80
|
+
var w = /(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;
|
|
81
|
+
function T(e) {
|
|
82
|
+
if (e.name) {
|
|
83
|
+
let t = e.toString();
|
|
84
|
+
return !w.test(t);
|
|
85
|
+
}
|
|
86
|
+
return !0;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/member.ts
|
|
90
|
+
function E(e) {
|
|
91
|
+
return Array.isArray(e) ? e : e == null ? [] : [e];
|
|
92
|
+
}
|
|
93
|
+
function D(e) {
|
|
94
|
+
for (let [t, n] of Object.entries(e)) e[t] = Array.isArray(n) ? n : n == null ? [] : [n];
|
|
95
|
+
return e;
|
|
96
|
+
}
|
|
97
|
+
function O() {
|
|
98
|
+
return function(e) {
|
|
99
|
+
return e;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/async.ts
|
|
104
|
+
function k(e, t) {
|
|
105
|
+
return e instanceof Promise ? e.then((e) => t(e, !1, void 0), (e) => t(void 0, !0, e)) : t(e, !1, void 0);
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/other.ts
|
|
109
|
+
var A = /* @__PURE__ */ function(e) {
|
|
110
|
+
return e.equal = "equal", e.intersect = "intersect", e.intersectEqual = "intersectEqual", e;
|
|
111
|
+
}({});
|
|
112
|
+
(function(e) {
|
|
113
|
+
function t(e) {
|
|
114
|
+
let t;
|
|
115
|
+
switch (e) {
|
|
116
|
+
case A.equal: t = ((e, t) => e === t);
|
|
117
|
+
case A.intersect: t = ((e, t) => e & t);
|
|
118
|
+
default: t = ((e, t) => (e & t) === e);
|
|
119
|
+
}
|
|
120
|
+
return t;
|
|
121
|
+
}
|
|
122
|
+
e.getEqualFun = t;
|
|
123
|
+
})(A ||= {});
|
|
124
|
+
//#endregion
|
|
125
|
+
export { A as BitFlagEqualTestType, E as formatAsArray, D as formatMemberAsArray, o as getExactTypeNameOf, a as getExactTypeOf, n as getNameOfType, r as getTypeByName, i as getTypeNameOf, t as getTypeOf, T as isAnonymousFunction, c as isArrayLike, _ as isArrowFunction, y as isAsyncFunction, C as isAsyncGeneratorFunction, s as isBaseType, f as isEmptyObject, p as isEmptyValue, d as isEmptyValue_Base, x as isGeneratorFunction, h as isIdentifier, l as isIterable, u as isIterator, e as isObject, O as patchType, k as waitAsyncable };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TypeTls={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){var t=typeof e;return e&&(t===`object`||t===`function`)}function n(e){var t=e;return e!=null&&(t=e.constructor,t??=typeof e),t}function r(e){switch(e){case void 0:return`undefined`;case null:return`null`}let t=typeof e;switch(t){case`function`:return e.name;case`string`:return e;default:return t}}function i(e){return globalThis[e]}function a(e){return r(n(e))}function o(e){return e==null||t(e)?n(e):typeof e}function s(e){return r(o(e))}function c(e){var t=typeof e;return e==null||t!==`object`&&t!==`function`}function l(e){let t=e&&e.length;return Number.isInteger(e.length)&&t>=0}function u(e){return e&&typeof e[Symbol.iterator]==`function`}function d(e){return e&&typeof e.next==`function`}function f(e){return e==null?!0:typeof e==`string`?e===``||e.trim()===``:!1}function p(e){return e==null?!0:typeof e==`object`?l(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:Reflect.ownKeys(e).length===0:!1}function m(e){return typeof e==`object`?p(e):f(e)}var h=/^[A-Za-z_$]+[\w$]*$/;function g(e){return h.test(e)}var _=/(^\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 v(e){let t=e.toString();return _.test(t)}var y=globalThis.AsyncFunction??async function(){}.constructor;function b(e){return e instanceof y}var x=globalThis.GeneratorFunction??function*(){}.constructor;function S(e){return e instanceof x}var C=globalThis.AsyncGeneratorFunction??async function*(){}.constructor;function w(e){return e instanceof C}var T=/(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;function E(e){if(e.name){let t=e.toString();return!T.test(t)}return!0}function D(e){return Array.isArray(e)?e:e==null?[]:[e]}function O(e){for(let[t,n]of Object.entries(e))e[t]=Array.isArray(n)?n:n==null?[]:[n];return e}function k(){return function(e){return e}}function A(e,t){return e instanceof Promise?e.then(e=>t(e,!1,void 0),e=>t(void 0,!0,e)):t(e,!1,void 0)}var j=function(e){return e.equal=`equal`,e.intersect=`intersect`,e.intersectEqual=`intersectEqual`,e}({});(function(e){function t(e){let t;switch(e){case j.equal:t=((e,t)=>e===t);case j.intersect:t=((e,t)=>e&t);default:t=((e,t)=>(e&t)===e)}return t}e.getEqualFun=t})(j||={}),Object.defineProperty(e,`BitFlagEqualTestType`,{enumerable:!0,get:function(){return j}}),e.formatAsArray=D,e.formatMemberAsArray=O,e.getExactTypeNameOf=s,e.getExactTypeOf=o,e.getNameOfType=r,e.getTypeByName=i,e.getTypeNameOf=a,e.getTypeOf=n,e.isAnonymousFunction=E,e.isArrayLike=l,e.isArrowFunction=v,e.isAsyncFunction=b,e.isAsyncGeneratorFunction=w,e.isBaseType=c,e.isEmptyObject=p,e.isEmptyValue=m,e.isEmptyValue_Base=f,e.isGeneratorFunction=S,e.isIdentifier=g,e.isIterable=u,e.isIterator=d,e.isObject=t,e.patchType=k,e.waitAsyncable=A});
|
package/dist/member.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyFunction } from "./function";
|
|
1
|
+
import type { AnyFunction } from "./function";
|
|
2
2
|
/**
|
|
3
3
|
* 获取对象的方法的某个参数的类型
|
|
4
4
|
*
|
|
@@ -53,3 +53,18 @@ export type FormatMemberAsArray<D> = {
|
|
|
53
53
|
* @returns 返回来的 data 对象,此方法会改变原对象 data,耗会生成新的对象
|
|
54
54
|
*/
|
|
55
55
|
export declare function formatMemberAsArray<D extends {}>(data: D): FormatMemberAsArray<D>;
|
|
56
|
+
/**
|
|
57
|
+
* 为对象添加类型补丁,拿 Patch 中的属性和方法,并添加到 Obj 中
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const info = patchType<{name:string,sex:"男"|"女"}>()({
|
|
61
|
+
* print(){
|
|
62
|
+
* this.name = "郭斌勇";
|
|
63
|
+
* this.sex = "男";
|
|
64
|
+
* }
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @returns 返回 传入的 obj 对象,但返回的类型是 Obj & Patch
|
|
69
|
+
*/
|
|
70
|
+
export declare function patchType<Patch>(): <Obj>(obj: Obj & ThisType<Patch & Obj>) => Patch & Obj;
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "type-tls",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "type-tls 封装了与类型相关的工具,比如:获取数据的类型 或 类型名字、判断数据的类型 等",
|
|
5
|
-
"main": "./dist/
|
|
6
|
-
"module": "./dist/
|
|
5
|
+
"main": "./dist/index.umd.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
|
-
"require": "./dist/type-tls.umd.cjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"
|
|
10
|
+
"require": "./dist/index.umd.cjs",
|
|
11
|
+
"import": "./dist/index.js"
|
|
11
12
|
},
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"homepage": "https://github.com/GuoBinyong/type-tls#readme",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@microsoft/api-documenter": "latest",
|
|
44
44
|
"@microsoft/api-extractor": "latest",
|
|
45
45
|
"build-tls": "latest",
|
|
46
|
+
"cross-env": "latest",
|
|
46
47
|
"dts-bundle-generator": "latest",
|
|
47
48
|
"package-tls": "latest",
|
|
48
49
|
"rollup-plugin-preserve-shebang": "latest",
|
|
@@ -56,8 +57,8 @@
|
|
|
56
57
|
"dev:bin": "vite-node src/bin.ts",
|
|
57
58
|
"build": "vite build",
|
|
58
59
|
"bunch": "vite build --mode bunch",
|
|
59
|
-
"debug": "debug=true vite build",
|
|
60
|
-
"debug:bunch": "debug=true vite build --mode bunch",
|
|
60
|
+
"debug": "cross-env debug=true vite build",
|
|
61
|
+
"debug:bunch": "cross-env debug=true vite build --mode bunch",
|
|
61
62
|
"exe": "bun build --compile --minify ./src/bin.ts --outfile ./exe/library-vite-template",
|
|
62
63
|
"exe:win": "bun build --compile --minify --target=bun-windows-x64 ./src/bin.ts --outfile ./exe/library-vite-template_win",
|
|
63
64
|
"exe:linux": "bun build --compile --minify --target=bun-linux-x64 ./src/bin.ts --outfile ./exe/library-vite-template_linux",
|
package/dist/type-tls.iife.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var TypeTls=function(e){"use strict";function s(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 f(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 g(n){return globalThis[n]}function m(n){let t=o(n);return f(t)}function a(n){return n==null||s(n)?o(n):typeof n}function b(n){var t=a(n);return f(t)}function T(n){var t=typeof n;return n==null||t!=="object"&&t!=="function"}function y(n){let t=n&&n.length;return Number.isInteger(n.length)&&t>=0}function F(n){return n&&typeof n[Symbol.iterator]=="function"}function O(n){return n&&typeof n.next=="function"}function l(n){return n==null?!0:typeof n=="string"?n===""||n.trim()==="":!1}function A(n){return n==null?!0:typeof n!="object"?!1:y(n)?n.length===0:n instanceof Map||n instanceof Set?n.size===0:Reflect.ownKeys(n).length===0}function E(n){return typeof n=="object"?A(n):l(n)}const w=/^[A-Za-z_$]+[\w$]*$/;function h(n){return w.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 d(n){const t=n.toString();return p.test(t)}const j=globalThis.AsyncFunction??(async function(){}).constructor;function S(n){return n instanceof j}const $=globalThis.GeneratorFunction??(function*(){}).constructor;function N(n){return n instanceof $}const q=globalThis.AsyncGeneratorFunction??(async function*(){}).constructor;function I(n){return n instanceof q}const G=/(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;function B(n){if(n.name){const t=n.toString();return!G.test(t)}return!0}function _(n){return Array.isArray(n)?n:n==null?[]:[n]}function z(n){for(const[t,r]of Object.entries(n))n[t]=Array.isArray(r)?r:r==null?[]:[r];return n}function Z(n,t){return n instanceof Promise?n.then(r=>t(r,!1,void 0),r=>t(void 0,!0,r)):t(n,!1,void 0)}return e.BitFlagEqualTestType=(n=>(n.equal="equal",n.intersect="intersect",n.intersectEqual="intersectEqual",n))(e.BitFlagEqualTestType||{}),(n=>{function t(r){let c;switch(r){case"equal":c=(i,u)=>i===u;case"intersect":c=(i,u)=>i&u;default:c=(i,u)=>(i&u)===i}return c}n.getEqualFun=t})(e.BitFlagEqualTestType||(e.BitFlagEqualTestType={})),e.formatAsArray=_,e.formatMemberAsArray=z,e.getExactTypeNameOf=b,e.getExactTypeOf=a,e.getNameOfType=f,e.getTypeByName=g,e.getTypeNameOf=m,e.getTypeOf=o,e.isAnonymousFunction=B,e.isArrayLike=y,e.isArrowFunction=d,e.isAsyncFunction=S,e.isAsyncGeneratorFunction=I,e.isBaseType=T,e.isEmptyObject=A,e.isEmptyValue=E,e.isEmptyValue_Base=l,e.isGeneratorFunction=N,e.isIdentifier=h,e.isIterable=F,e.isIterator=O,e.isObject=s,e.waitAsyncable=Z,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
package/dist/type-tls.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
function f(n) {
|
|
2
|
-
var t = typeof n;
|
|
3
|
-
return n && (t === "object" || t === "function");
|
|
4
|
-
}
|
|
5
|
-
function c(n) {
|
|
6
|
-
var t = n;
|
|
7
|
-
return n != null && (t = n.constructor, t == null && (t = typeof n)), t;
|
|
8
|
-
}
|
|
9
|
-
function s(n) {
|
|
10
|
-
switch (n) {
|
|
11
|
-
case void 0:
|
|
12
|
-
return "undefined";
|
|
13
|
-
case null:
|
|
14
|
-
return "null";
|
|
15
|
-
}
|
|
16
|
-
let t = typeof n;
|
|
17
|
-
switch (t) {
|
|
18
|
-
case "function":
|
|
19
|
-
return n.name;
|
|
20
|
-
case "string":
|
|
21
|
-
return n;
|
|
22
|
-
default:
|
|
23
|
-
return t;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function w(n) {
|
|
27
|
-
return globalThis[n];
|
|
28
|
-
}
|
|
29
|
-
function $(n) {
|
|
30
|
-
let t = c(n);
|
|
31
|
-
return s(t);
|
|
32
|
-
}
|
|
33
|
-
function y(n) {
|
|
34
|
-
return n == null || f(n) ? c(n) : typeof n;
|
|
35
|
-
}
|
|
36
|
-
function O(n) {
|
|
37
|
-
var t = y(n);
|
|
38
|
-
return s(t);
|
|
39
|
-
}
|
|
40
|
-
function E(n) {
|
|
41
|
-
var t = typeof n;
|
|
42
|
-
return n == null || t !== "object" && t !== "function";
|
|
43
|
-
}
|
|
44
|
-
function a(n) {
|
|
45
|
-
let t = n && n.length;
|
|
46
|
-
return Number.isInteger(n.length) && t >= 0;
|
|
47
|
-
}
|
|
48
|
-
function S(n) {
|
|
49
|
-
return n && typeof n[Symbol.iterator] == "function";
|
|
50
|
-
}
|
|
51
|
-
function T(n) {
|
|
52
|
-
return n && typeof n.next == "function";
|
|
53
|
-
}
|
|
54
|
-
function l(n) {
|
|
55
|
-
return n == null ? !0 : typeof n == "string" ? n === "" || n.trim() === "" : !1;
|
|
56
|
-
}
|
|
57
|
-
function p(n) {
|
|
58
|
-
return n == null ? !0 : typeof n != "object" ? !1 : a(n) ? n.length === 0 : n instanceof Map || n instanceof Set ? n.size === 0 : Reflect.ownKeys(n).length === 0;
|
|
59
|
-
}
|
|
60
|
-
function d(n) {
|
|
61
|
-
return typeof n == "object" ? p(n) : l(n);
|
|
62
|
-
}
|
|
63
|
-
const A = /^[A-Za-z_$]+[\w$]*$/;
|
|
64
|
-
function j(n) {
|
|
65
|
-
return A.test(n);
|
|
66
|
-
}
|
|
67
|
-
const g = /(^\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*=>)/;
|
|
68
|
-
function q(n) {
|
|
69
|
-
const t = n.toString();
|
|
70
|
-
return g.test(t);
|
|
71
|
-
}
|
|
72
|
-
const b = globalThis.AsyncFunction ?? (async function() {
|
|
73
|
-
}).constructor;
|
|
74
|
-
function x(n) {
|
|
75
|
-
return n instanceof b;
|
|
76
|
-
}
|
|
77
|
-
const m = globalThis.GeneratorFunction ?? (function* () {
|
|
78
|
-
}).constructor;
|
|
79
|
-
function z(n) {
|
|
80
|
-
return n instanceof m;
|
|
81
|
-
}
|
|
82
|
-
const F = globalThis.AsyncGeneratorFunction ?? (async function* () {
|
|
83
|
-
}).constructor;
|
|
84
|
-
function G(n) {
|
|
85
|
-
return n instanceof F;
|
|
86
|
-
}
|
|
87
|
-
const h = /(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;
|
|
88
|
-
function I(n) {
|
|
89
|
-
if (n.name) {
|
|
90
|
-
const t = n.toString();
|
|
91
|
-
return !h.test(t);
|
|
92
|
-
}
|
|
93
|
-
return !0;
|
|
94
|
-
}
|
|
95
|
-
function N(n) {
|
|
96
|
-
return Array.isArray(n) ? n : n == null ? [] : [n];
|
|
97
|
-
}
|
|
98
|
-
function _(n) {
|
|
99
|
-
for (const [t, r] of Object.entries(n))
|
|
100
|
-
n[t] = Array.isArray(r) ? r : r == null ? [] : [r];
|
|
101
|
-
return n;
|
|
102
|
-
}
|
|
103
|
-
function Z(n, t) {
|
|
104
|
-
return n instanceof Promise ? n.then((r) => t(r, !1, void 0), (r) => t(void 0, !0, r)) : t(n, !1, void 0);
|
|
105
|
-
}
|
|
106
|
-
var i = /* @__PURE__ */ ((n) => (n.equal = "equal", n.intersect = "intersect", n.intersectEqual = "intersectEqual", n))(i || {});
|
|
107
|
-
((n) => {
|
|
108
|
-
function t(r) {
|
|
109
|
-
let u;
|
|
110
|
-
switch (r) {
|
|
111
|
-
case "equal":
|
|
112
|
-
u = (e, o) => e === o;
|
|
113
|
-
case "intersect":
|
|
114
|
-
u = (e, o) => e & o;
|
|
115
|
-
default:
|
|
116
|
-
u = (e, o) => (e & o) === e;
|
|
117
|
-
}
|
|
118
|
-
return u;
|
|
119
|
-
}
|
|
120
|
-
n.getEqualFun = t;
|
|
121
|
-
})(i || (i = {}));
|
|
122
|
-
export {
|
|
123
|
-
i as BitFlagEqualTestType,
|
|
124
|
-
N as formatAsArray,
|
|
125
|
-
_ as formatMemberAsArray,
|
|
126
|
-
O as getExactTypeNameOf,
|
|
127
|
-
y as getExactTypeOf,
|
|
128
|
-
s as getNameOfType,
|
|
129
|
-
w as getTypeByName,
|
|
130
|
-
$ as getTypeNameOf,
|
|
131
|
-
c as getTypeOf,
|
|
132
|
-
I as isAnonymousFunction,
|
|
133
|
-
a as isArrayLike,
|
|
134
|
-
q as isArrowFunction,
|
|
135
|
-
x as isAsyncFunction,
|
|
136
|
-
G as isAsyncGeneratorFunction,
|
|
137
|
-
E as isBaseType,
|
|
138
|
-
p as isEmptyObject,
|
|
139
|
-
d as isEmptyValue,
|
|
140
|
-
l as isEmptyValue_Base,
|
|
141
|
-
z as isGeneratorFunction,
|
|
142
|
-
j as isIdentifier,
|
|
143
|
-
S as isIterable,
|
|
144
|
-
T as isIterator,
|
|
145
|
-
f as isObject,
|
|
146
|
-
Z as waitAsyncable
|
|
147
|
-
};
|
package/dist/type-tls.umd.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 f(n){var e=n;return n!=null&&(e=n.constructor,e==null&&(e=typeof n)),e}function s(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 m(n){return globalThis[n]}function g(n){let e=f(n);return s(e)}function a(n){return n==null||i(n)?f(n):typeof n}function T(n){var e=a(n);return s(e)}function b(n){var e=typeof n;return n==null||e!=="object"&&e!=="function"}function y(n){let e=n&&n.length;return Number.isInteger(n.length)&&e>=0}function F(n){return n&&typeof n[Symbol.iterator]=="function"}function d(n){return n&&typeof n.next=="function"}function l(n){return n==null?!0:typeof n=="string"?n===""||n.trim()==="":!1}function A(n){return n==null?!0:typeof n!="object"?!1:y(n)?n.length===0:n instanceof Map||n instanceof Set?n.size===0:Reflect.ownKeys(n).length===0}function p(n){return typeof n=="object"?A(n):l(n)}const O=/^[A-Za-z_$]+[\w$]*$/;function E(n){return O.test(n)}const h=/(^\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 e=n.toString();return h.test(e)}const j=globalThis.AsyncFunction??(async function(){}).constructor;function S(n){return n instanceof j}const $=globalThis.GeneratorFunction??(function*(){}).constructor;function N(n){return n instanceof $}const q=globalThis.AsyncGeneratorFunction??(async function*(){}).constructor;function I(n){return n instanceof q}const G=/(^\s*(async\s+)?function\s*(\s|\*)\s*)[A-Za-z_$]+[\w$]*(\s*\()/;function B(n){if(n.name){const e=n.toString();return!G.test(e)}return!0}function _(n){return Array.isArray(n)?n:n==null?[]:[n]}function z(n){for(const[e,r]of Object.entries(n))n[e]=Array.isArray(r)?r:r==null?[]:[r];return n}function Z(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.formatAsArray=_,t.formatMemberAsArray=z,t.getExactTypeNameOf=T,t.getExactTypeOf=a,t.getNameOfType=s,t.getTypeByName=m,t.getTypeNameOf=g,t.getTypeOf=f,t.isAnonymousFunction=B,t.isArrayLike=y,t.isArrowFunction=w,t.isAsyncFunction=S,t.isAsyncGeneratorFunction=I,t.isBaseType=b,t.isEmptyObject=A,t.isEmptyValue=p,t.isEmptyValue_Base=l,t.isGeneratorFunction=N,t.isIdentifier=E,t.isIterable=F,t.isIterator=d,t.isObject=i,t.waitAsyncable=Z,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|