@carlsebastian/jsu 1.1.1 → 1.2.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/package.json +1 -1
- package/src/types/arithmetic/arithmetic.d.ts +52 -93
- package/src/types/custom/custom.d.ts +6 -1
- package/src/types/custom/error/builder/error.builder.d.ts +2 -2
- package/src/types/custom/error/constructor/error.base.d.ts +3 -1
- package/src/types/custom/error/constructor/error.custom.d.ts +11 -9
- package/src/types/custom/error/constructor/error.meta.d.ts +9 -9
- package/src/types/custom/error/error.d.ts +18 -1
- package/src/types/custom/utils/custom.utils.d.ts +2 -2
- package/src/types/custom/utils/generator/generator.d.ts +5 -5
- package/src/types/dom/attr/attr.class.d.ts +1 -1
- package/src/types/dom/attr/attr.id.d.ts +1 -1
- package/src/types/dom/attr/attr.style.d.ts +3 -1
- package/src/types/dom/dom.d.ts +115 -1
- package/src/types/dom/element/create/element.create.d.ts +3 -1
- package/src/types/{api → dom/element}/element.d.ts +14 -14
- package/src/types/dom/element/getElementBy/dom.getElementBy.d.ts +3 -1
- package/src/types/dom/element/tag-verifier/verifier.d.ts +3 -1
- package/src/types/global.d.ts +19 -9
- package/src/types/guards/format/guards.format.d.ts +155 -0
- package/src/types/guards/guards.d.ts +6 -1
- package/src/types/guards/type/guards.type.d.ts +120 -0
- package/src/types/primitives/obj/obj.accessor.d.ts +219 -3
- package/src/types/primitives/obj/obj.iterator.d.ts +60 -3
- package/src/types/primitives/primitives.d.ts +7 -1
- package/src/types/primitives/str/str.d.ts +1 -1
- package/src/types/storage/local/storage.local.d.ts +8 -8
- package/src/types/storage/session/storage.session.d.ts +8 -8
- package/src/types/storage/storage.d.ts +22 -1
- package/src/types/variables.d.ts +27 -0
- package/src/utils/arithmetic/arithmetic.js +3 -3
- package/src/utils/arithmetic/operations/operation.divide.js +1 -1
- package/src/utils/arithmetic/operations/operation.multiply.js +1 -1
- package/src/utils/arithmetic/operations/operation.subtract.js +1 -1
- package/src/utils/arithmetic/operations/operation.sum.js +1 -1
- package/src/utils/custom/custom.js +3 -3
- package/src/utils/custom/error/error.js +3 -3
- package/src/utils/custom/utils/custom.utils.js +2 -2
- package/src/utils/custom/utils/generator/generator.js +2 -2
- package/src/utils/dom/attr/attr.class.js +2 -2
- package/src/utils/dom/attr/attr.id.js +2 -2
- package/src/utils/dom/attr/attr.style.js +2 -2
- package/src/utils/dom/dom.js +3 -3
- package/src/utils/dom/element/create/element.create.js +2 -2
- package/src/utils/dom/element/getElementBy/dom.getElementBy.js +2 -2
- package/src/utils/dom/element/query/dom.query.js +2 -2
- package/src/utils/dom/element/tag-verifier/verifier.js +2 -2
- package/src/utils/dom/lifecycle/mount.js +2 -2
- package/src/utils/dom/lifecycle/unmount.js +1 -6
- package/src/utils/guards/{formats/formats.js → format/guards.format.js} +1 -52
- package/src/utils/guards/guards.js +3 -3
- package/src/utils/guards/{data-types/data-types.js → type/guards.type.js} +0 -14
- package/src/utils/primitives/obj/obj.accessor.js +6 -6
- package/src/utils/primitives/obj/obj.iterator.js +58 -81
- package/src/utils/primitives/primitives.js +5 -5
- package/src/utils/storage/storage.js +2 -2
- package/src/types/api/api.d.ts +0 -165
- package/src/types/guards/data-types/data-types.d.ts +0 -5
- package/src/types/guards/formats/formats.d.ts +0 -5
package/src/types/dom/dom.d.ts
CHANGED
|
@@ -1,8 +1,122 @@
|
|
|
1
|
+
import { DOMClassOfAPI } from "./attr/attr.class.js";
|
|
2
|
+
import { DOMIdOfAPI } from "./attr/attr.id.js";
|
|
3
|
+
import { DOMStyleOfAPI } from "./attr/attr.style.js";
|
|
4
|
+
import { DOMCreateAPI } from "./element/create/element.create.js";
|
|
5
|
+
import { ElementTags, ResolveTag } from "./element/element.js";
|
|
6
|
+
import { DOMGetElementByAPI } from "./element/getElementBy/dom.getElementBy.js";
|
|
7
|
+
import { VerifierTagAPI } from "./element/tag-verifier/verifier.js";
|
|
8
|
+
|
|
9
|
+
export interface DomAPI {
|
|
10
|
+
/**
|
|
11
|
+
* Access the element's `DOMTokenList` and returns set collection of for it.
|
|
12
|
+
*
|
|
13
|
+
* @param element - The element to access the `DOMTokenList`.
|
|
14
|
+
*/
|
|
15
|
+
ClassOf(element: Element): DOMClassOfAPI;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A collection of customized and enhanced `create` of `DocumentObjectModel`.
|
|
19
|
+
*/
|
|
20
|
+
Create: DOMCreateAPI;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Access the element's `id` attribute and returns a set of for it.
|
|
24
|
+
*
|
|
25
|
+
* @param element - The element to access the `id` attribute.
|
|
26
|
+
*/
|
|
27
|
+
IdOf(element: Element): DOMIdOfAPI;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A enhanced version collection of element retrieval methods.
|
|
31
|
+
*/
|
|
32
|
+
GetElementBy: DOMGetElementByAPI;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Mounts the given `childNode` to its given `parentNode`.
|
|
36
|
+
*
|
|
37
|
+
* @param parentNode - The parent node to mount the given child node.
|
|
38
|
+
* @param childNode - The given child node to mount.
|
|
39
|
+
*/
|
|
40
|
+
Mount(parentNode: ParentNode, childNode: ChildNode): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Mounts the given `childNode` collection to its given `parentNode`.
|
|
44
|
+
*
|
|
45
|
+
* @param parentNode - The parent node to mount the given collection of child node.
|
|
46
|
+
* @param childNodes - The given collection of child nodes to mount.
|
|
47
|
+
*/
|
|
48
|
+
Mount(parentNode: ParentNode, ...childNodes: ChildNode[]): void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Search and retrieves the first element to match the given selector.
|
|
52
|
+
*
|
|
53
|
+
* @param selector - The selector of element to search.
|
|
54
|
+
* @returns The element that matches the given selector.
|
|
55
|
+
*/
|
|
56
|
+
Select<T extends keyof ElementTags>(selector: T): ResolveTag<T>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Search and retrieves the first element to match the given selector.
|
|
60
|
+
*
|
|
61
|
+
* @param selector - The selector of element to search.
|
|
62
|
+
* @param root - The parent element to search the given element selector at. (Default: Document)
|
|
63
|
+
* @returns The element that matches the given selector.
|
|
64
|
+
*/
|
|
65
|
+
Select<T extends keyof ElementTags>(selector: T, root: ParentNode): ResolveTag<T>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Search and retrieves the collection of elements that matches the given selector.
|
|
69
|
+
*
|
|
70
|
+
* @param selector - The selector of elements to search.
|
|
71
|
+
* @returns The collection of elements that matches the given selector.
|
|
72
|
+
*/
|
|
73
|
+
SelectAll<T extends keyof ElementTags>(selector: T): ResolveTag<T>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Search and retrieves the collection of elements that matches the given selector.
|
|
77
|
+
*
|
|
78
|
+
* @param selector - The selector of elements to search.
|
|
79
|
+
* @param root - The parent element to search the given element selector at. (Default: Document)
|
|
80
|
+
* @returns The collection of elements that matches the given selector.
|
|
81
|
+
*/
|
|
82
|
+
SelectAll<T extends keyof ElementTags>(selector: T, root?: ParentNode): ResolveTag<T>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Access the element's `CSSStyleDeclaration` and returns a set collection of for it.
|
|
86
|
+
*
|
|
87
|
+
* @param element - The element to access its `CSSStyleDeclaration`.
|
|
88
|
+
*/
|
|
89
|
+
StyleOf(element: Element): DOMStyleOfAPI;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Unmounts the given `childNode` from its `parentNode`.
|
|
93
|
+
*
|
|
94
|
+
* @param childNode - The child node to unmount.
|
|
95
|
+
*/
|
|
96
|
+
Unmount(childNode: ChildNode): void;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Unmounts the given `childNode` collection from their `parentNode`.
|
|
100
|
+
*
|
|
101
|
+
* @param childNodes - The collection of child nodes to unmount.
|
|
102
|
+
*/
|
|
103
|
+
Unmount(...childNodes: ChildNode[]): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Verifies the given tag of element.
|
|
107
|
+
*
|
|
108
|
+
* @param tag - The tag of element to verify.
|
|
109
|
+
*
|
|
110
|
+
* @throw {ArgumentError} - When parameter tag is not in string format.
|
|
111
|
+
*/
|
|
112
|
+
VerifyTag<KTag extends keyof ElementTags>(tag: KTag): VerifierTagAPI<KTag>;
|
|
113
|
+
}
|
|
114
|
+
|
|
1
115
|
declare global {
|
|
2
116
|
/**
|
|
3
117
|
* A collection of customized and/or enhanced `DocumentObjectModel` methods.
|
|
4
118
|
*/
|
|
5
|
-
|
|
119
|
+
var DOM: DomAPI;
|
|
6
120
|
}
|
|
7
121
|
|
|
8
122
|
export { }
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { HTMLElementConfig, HTMLElementTags, MathElementConfig, MathElementTags, ResolveTag, SVGElementConfig, SVGElementTags } from "../element.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A collection of `DOM` element creation API methods.
|
|
3
5
|
*/
|
|
4
|
-
interface DOMCreateAPI {
|
|
6
|
+
export interface DOMCreateAPI {
|
|
5
7
|
/**
|
|
6
8
|
* Generates an instance of `HTMLElement` with the given qualified tag.
|
|
7
9
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
type HTMLElementTags = HTMLElementTagNameMap;
|
|
2
|
-
type MathElementTags = MathMLElementTagNameMap;
|
|
3
|
-
type SVGElementTags = SVGElementTagNameMap;
|
|
4
|
-
type ElementTags = HTMLElementTags & MathElementTags & SVGElementTags;
|
|
5
|
-
type CSSDeclaration = CSSStyleDeclaration;
|
|
1
|
+
export type HTMLElementTags = HTMLElementTagNameMap;
|
|
2
|
+
export type MathElementTags = MathMLElementTagNameMap;
|
|
3
|
+
export type SVGElementTags = SVGElementTagNameMap;
|
|
4
|
+
export type ElementTags = HTMLElementTags & MathElementTags & SVGElementTags;
|
|
5
|
+
export type CSSDeclaration = CSSStyleDeclaration;
|
|
6
6
|
|
|
7
|
-
type XMLNameSpace = "http://www.w3.org/1998/Math/MathML" | "http://www.w3.org/1999/xhtml" | "http://www.w3.org/2000/svg";
|
|
7
|
+
export type XMLNameSpace = "http://www.w3.org/1998/Math/MathML" | "http://www.w3.org/1999/xhtml" | "http://www.w3.org/2000/svg";
|
|
8
8
|
|
|
9
|
-
type HTMLElementConfig = {
|
|
9
|
+
export type HTMLElementConfig = {
|
|
10
10
|
ClassNames?: string | string[];
|
|
11
11
|
Id?: string;
|
|
12
12
|
Text?: string;
|
|
@@ -14,7 +14,7 @@ type HTMLElementConfig = {
|
|
|
14
14
|
[OtherAttr: string]: any;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
type MathElementConfig = {
|
|
17
|
+
export type MathElementConfig = {
|
|
18
18
|
Data?: {
|
|
19
19
|
[DataCustomKey: string]: string;
|
|
20
20
|
},
|
|
@@ -30,7 +30,7 @@ type MathElementConfig = {
|
|
|
30
30
|
ScriptLevel?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
type SVGElementConfig = {
|
|
33
|
+
export type SVGElementConfig = {
|
|
34
34
|
ClassNames?: string | string[];
|
|
35
35
|
Id?: string;
|
|
36
36
|
Styles?: CSSDeclaration;
|
|
@@ -40,16 +40,16 @@ type SVGElementConfig = {
|
|
|
40
40
|
[OtherAttr: string]: any;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
type ResolveTag<T extends keyof ElementTags> =
|
|
43
|
+
export type ResolveTag<T extends keyof ElementTags> =
|
|
44
44
|
T extends keyof HTMLElementTags ? HTMLElementTags[T] :
|
|
45
45
|
T extends keyof MathElementTags ? MathElementTags[T] :
|
|
46
46
|
T extends keyof SVGElementTags ? SVGElementTags[T] : null;
|
|
47
47
|
|
|
48
|
-
type ResolveTagNS<NS extends XMLNameSpace, T extends keyof ElementTags> =
|
|
48
|
+
export type ResolveTagNS<NS extends XMLNameSpace, T extends keyof ElementTags> =
|
|
49
49
|
NS extends "http://www.w3.org/1998/Math/MathML" ?
|
|
50
|
-
|
|
50
|
+
T extends keyof MathElementTags ? MathElementTags[T] : MathMLElement :
|
|
51
51
|
NS extends "http://www.w3.org/1999/xhtml" ?
|
|
52
|
-
|
|
52
|
+
T extends keyof HTMLElementTags ? HTMLElementTags[T] : HTMLElement :
|
|
53
53
|
NS extends "http://www.w3.org/2000/svg" ?
|
|
54
|
-
|
|
54
|
+
T extends keyof SVGElementTags ? SVGElementTags[T] : SVGElement :
|
|
55
55
|
never;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ElementTags, ResolveTag } from "../element.js";
|
|
2
|
+
|
|
3
|
+
export interface VerifierTagAPI<K extends keyof ElementTags> {
|
|
2
4
|
/**
|
|
3
5
|
* Verifies the given tag of element whether if its qualified as instance of `HTMLElement`.
|
|
4
6
|
*/
|
package/src/types/global.d.ts
CHANGED
|
@@ -8,16 +8,26 @@
|
|
|
8
8
|
/// <reference types="./primitives/primitives.d.ts" />
|
|
9
9
|
/// <reference types="./storage/storage.d.ts" />
|
|
10
10
|
|
|
11
|
+
import { ArithmeticAPI } from "./arithmetic/arithmetic.js";
|
|
12
|
+
import { CustomAPI } from "./custom/custom.js";
|
|
13
|
+
import { DomAPI } from "./dom/dom.js";
|
|
14
|
+
import { DOMGetElementByAPI } from "./dom/element/getElementBy/dom.getElementBy.js";
|
|
15
|
+
import { ErrorAPI } from "./custom/error/error.js";
|
|
16
|
+
import { GuardsAPI } from "./guards/guards.js";
|
|
17
|
+
import { PrimitivesAPI } from "./primitives/primitives.js";
|
|
18
|
+
import { StorageAPI } from "./storage/storage.js";
|
|
19
|
+
import { VariablesAPI } from "./variables.js";
|
|
20
|
+
|
|
11
21
|
declare global {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
var Arithmetic: ArithmeticAPI;
|
|
23
|
+
var Custom: CustomAPI;
|
|
24
|
+
var DOM: DomAPI;
|
|
25
|
+
var ERROR: ErrorAPI;
|
|
26
|
+
var GetElementBy: DOMGetElementByAPI;
|
|
27
|
+
var Guards: GuardsAPI;
|
|
28
|
+
var Primitives: PrimitivesAPI;
|
|
29
|
+
var STORAGE: StorageAPI;
|
|
30
|
+
var Variables: VariablesAPI;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
export { };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export interface FormatGuardsAPI {
|
|
2
|
+
/**
|
|
3
|
+
* Validates whether if the specified ***function*** argument is ***anonymous***.
|
|
4
|
+
*
|
|
5
|
+
* @param func - The function to validate.
|
|
6
|
+
*/
|
|
7
|
+
IsFuncAnonymous(func: Function): boolean;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Validates whether if the specified ***function*** argument is ***asynchronous***.
|
|
11
|
+
*
|
|
12
|
+
* @param func - The function to validate.
|
|
13
|
+
*/
|
|
14
|
+
IsFuncAsynchronous(func: Function): func is AsyncGeneratorFunction;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Validates whether if the specified ***string*** argument includes lowercase characters.
|
|
18
|
+
*
|
|
19
|
+
* @param str - The string to validate.
|
|
20
|
+
*/
|
|
21
|
+
HasLowerCase(str: string): boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Validates whether if the specified ***string*** argument starts with lowercase character.
|
|
25
|
+
*
|
|
26
|
+
* @param str - The string to validate.
|
|
27
|
+
*/
|
|
28
|
+
IsStartsWithLowerCase(str: string): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Validates whether if the specified ***string*** argument ends with lowercase character.
|
|
32
|
+
*
|
|
33
|
+
* @param str - The string to validate.
|
|
34
|
+
*/
|
|
35
|
+
IsEndsWithLowerCase(str: string): boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Validates whether if the specified ***string*** argument includes uppercase characters.
|
|
39
|
+
*
|
|
40
|
+
* @param str - The string to validate.
|
|
41
|
+
*/
|
|
42
|
+
HasUpperCase(str: string): boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Validates whether if the specified ***string*** argument starts with uppercase character.
|
|
46
|
+
*
|
|
47
|
+
* @param str - The string to validate.
|
|
48
|
+
*/
|
|
49
|
+
IsStartsWithUpperCase(str)
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Validates whether if the specified ***string*** argument ends with uppercase character.
|
|
53
|
+
*
|
|
54
|
+
* @param str - The string to validate.
|
|
55
|
+
*/
|
|
56
|
+
IsEndsWithUpperCase(str: string): boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Validates whether if the specified ***string*** argument includes numbers.
|
|
60
|
+
*
|
|
61
|
+
* @param str - The string to validate.
|
|
62
|
+
*/
|
|
63
|
+
HasNumbers(str: string): boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Validates whether if the specified ***string*** argument starts with number.
|
|
67
|
+
*
|
|
68
|
+
* @param str - The string to validate.
|
|
69
|
+
*/
|
|
70
|
+
IsStartsWithNumber(str: string): boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Validates whether if the specified ***string*** argument ends with number.
|
|
74
|
+
*
|
|
75
|
+
* @param str - The string to validate.
|
|
76
|
+
*/
|
|
77
|
+
IsEndsWithNumber(str: string): boolean;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Validates whether if the specified ***string*** argument includes specified characters.
|
|
81
|
+
*
|
|
82
|
+
* @param str - The string to validate.
|
|
83
|
+
*/
|
|
84
|
+
HasSpecialCharacters(str: string): boolean;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Validates whether if the specified ***string*** argument starts with special character.
|
|
88
|
+
*
|
|
89
|
+
* @param str - The string to validate.
|
|
90
|
+
*/
|
|
91
|
+
IsStartsWithSpecialCharacter(str: string): boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Validates whether if the specified ***string*** argument ends with special character.
|
|
95
|
+
*
|
|
96
|
+
* @param str - The string to validate.
|
|
97
|
+
*/
|
|
98
|
+
IsEndsWithSpecialCharacter(str: string): boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Validates whether if the specified ***string*** argument includes ASCII characters.
|
|
102
|
+
*
|
|
103
|
+
* @param str - The string to validate.
|
|
104
|
+
*/
|
|
105
|
+
HasASCII(str: string): boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Validates whether if the specified ***string*** argument starts with ASCII character.
|
|
109
|
+
*
|
|
110
|
+
* @param str - The string to validate.
|
|
111
|
+
*/
|
|
112
|
+
IsStartsWithASCII(str: string): boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Validates whether if the specified ***string*** argument ends with ASCII character.
|
|
116
|
+
*
|
|
117
|
+
* @param str - The string to validate.
|
|
118
|
+
*/
|
|
119
|
+
IsEndsWithASCII(str: string): boolean;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Validates whether if the specified ***string*** argument is empty.
|
|
123
|
+
*
|
|
124
|
+
* @param str - The string to validate.
|
|
125
|
+
*/
|
|
126
|
+
IsStrEmpty(str: string): boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Validates whether if the specified ***array*** argument is empty.
|
|
130
|
+
*
|
|
131
|
+
* @param arr - The array to validate.
|
|
132
|
+
*/
|
|
133
|
+
IsArrEmpty(arr: Array<unknown>): arr is never[];
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Validates whether if the specified ***plain object*** is empty.
|
|
137
|
+
*
|
|
138
|
+
* @param obj - The plain object to validate.
|
|
139
|
+
*/
|
|
140
|
+
IsPlainObjEmpty(obj: { [prop: string]: unknown }): boolean;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Validates whether if the specified ***map object*** is empty.
|
|
144
|
+
*
|
|
145
|
+
* @param mObj - The map object to validate.
|
|
146
|
+
*/
|
|
147
|
+
IsMapObjEmpty(mObj: Map<unknown, unknown>): boolean;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Validates whether if the specified ***set object*** is empty.
|
|
151
|
+
*
|
|
152
|
+
* @param sObj - The set object to validate.
|
|
153
|
+
*/
|
|
154
|
+
IsSetObjEmpty(sObj: Set<unknown>): boolean;
|
|
155
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { FormatGuardsAPI } from "./format/guards.format.js";
|
|
2
|
+
import { TypeGuardsAPI } from "./type/guards.type.js";
|
|
3
|
+
|
|
4
|
+
export type GuardsAPI = FormatGuardsAPI & TypeGuardsAPI;
|
|
5
|
+
|
|
1
6
|
declare global {
|
|
2
7
|
/**
|
|
3
8
|
* A collection of data types and formats guards validation.
|
|
4
9
|
*/
|
|
5
|
-
|
|
10
|
+
var Guards: GuardsAPI;
|
|
6
11
|
}
|
|
7
12
|
|
|
8
13
|
export { }
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export interface TypeGuardsAPI {
|
|
2
|
+
/**
|
|
3
|
+
* Validates whether if the specified argument is `null` or `undefined`.
|
|
4
|
+
*
|
|
5
|
+
* @param arg - The argument to validate.
|
|
6
|
+
*/
|
|
7
|
+
IsNullOrUndefined<T>(arg: T): Extract<T, null | undefined>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Validates whether if the specified argument is a `string`.
|
|
11
|
+
*
|
|
12
|
+
* @param arg - The argument to validate.
|
|
13
|
+
*/
|
|
14
|
+
IsStr(arg: any): arg is string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Validates whether if the specified argument is an `array`.
|
|
18
|
+
*
|
|
19
|
+
* @param arg - The argument to validate.
|
|
20
|
+
*/
|
|
21
|
+
IsArr(arg: any): arg is Array;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Validates whether if the specified argument is a `function`.
|
|
25
|
+
*
|
|
26
|
+
* @param arg - The argument to validate.
|
|
27
|
+
*/
|
|
28
|
+
IsFunc(arg: any): arg is Function;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Validates whether if the specified argument is a `map object`.
|
|
32
|
+
*
|
|
33
|
+
* @param arg - The argument to validate.
|
|
34
|
+
*/
|
|
35
|
+
IsMapObj(arg: any): arg is Map;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Validates whether if the specified argument is a `set object`.
|
|
39
|
+
*
|
|
40
|
+
* @param arg - The argument to validate.
|
|
41
|
+
*/
|
|
42
|
+
IsSetObj(arg: any): arg is Set;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Validates whether if the specified argument is a `plain object`.
|
|
46
|
+
*
|
|
47
|
+
* @param arg - The argument to validate.
|
|
48
|
+
*/
|
|
49
|
+
IsPlainObj(arg: any): arg is { [prop: string]: any }
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Validates whether if the specified argument is a `boolean`.
|
|
53
|
+
*
|
|
54
|
+
* @param arg - The argument to validate.
|
|
55
|
+
*/
|
|
56
|
+
IsBool(arg: any): arg is boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Validates whether if the specified argument is a `number`.
|
|
60
|
+
*
|
|
61
|
+
* @param arg - The argument to validate.
|
|
62
|
+
*/
|
|
63
|
+
IsNum(arg: any): arg is number;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Validates whether if the specified argument is a `Node`.
|
|
67
|
+
*
|
|
68
|
+
* @param arg - The argument to validate.
|
|
69
|
+
*/
|
|
70
|
+
IsNode(arg: any): arg is Node;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Validates whether if the specified argument is a `ParentNode`.
|
|
74
|
+
*
|
|
75
|
+
* @param arg - The argument to validate.
|
|
76
|
+
*/
|
|
77
|
+
IsParentNode(arg: any): arg is ParentNode;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Validates whether if the specified argument is a `ChildNode`.
|
|
81
|
+
*
|
|
82
|
+
* @param arg - The argument to validate.
|
|
83
|
+
*/
|
|
84
|
+
IsChildNode(arg: any): arg is ChildNode;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Validates whether if the specified argument is an `Element` or instance of it.
|
|
88
|
+
*
|
|
89
|
+
* @param arg - The argument to validate.
|
|
90
|
+
*/
|
|
91
|
+
IsElement(arg: any): arg is Element;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Validates whether if the specified argument is an `HTMLElement` or instance of it.
|
|
95
|
+
*
|
|
96
|
+
* @param arg - The argument to validate.
|
|
97
|
+
*/
|
|
98
|
+
IsHTMLElement(arg: any): arg is HTMLElement;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Validates whether if the specified argument is an `HTMLUnknownElement` or instance of it.
|
|
102
|
+
*
|
|
103
|
+
* @param arg - The argument to validate.
|
|
104
|
+
*/
|
|
105
|
+
IsUnknownElement(arg: any): arg is HTMLUnknownElement;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Validates whether if the specified argument is `Iterator`.
|
|
109
|
+
*
|
|
110
|
+
* @param arg - The argument to validate.
|
|
111
|
+
*/
|
|
112
|
+
IsIterator(arg: any): arg is Iterator;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Validates whether if the specified argument is `RegExp`.
|
|
116
|
+
*
|
|
117
|
+
* @param arg - The argument to validate.
|
|
118
|
+
*/
|
|
119
|
+
IsRegExp(arg: any): arg is RegExp;
|
|
120
|
+
}
|