@carlsebastian/jsu 1.0.40 → 1.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/README.MD +112 -0
- package/global.js +1 -0
- package/package.json +31 -3
- package/src/docs/api/api.md +22 -0
- package/src/docs/custom/custom.md +38 -0
- package/src/docs/custom/error/builder/builder.md +24 -0
- package/src/docs/custom/error/constructor/error.constructor.md +33 -0
- package/src/docs/custom/error/constructor/opts/argumentError.md +78 -0
- package/src/docs/custom/error/constructor/opts/indexOutOfBounds.md +77 -0
- package/src/docs/custom/error/constructor/opts/invalidPropertyError.md +83 -0
- package/src/docs/custom/error/constructor/opts/missingParameterError.md +75 -0
- package/src/docs/custom/error/constructor/opts/missingPropertyError.md +81 -0
- package/src/docs/custom/error/constructor/opts/noSuchElementTagError.md +81 -0
- package/src/docs/custom/error/constructor/opts/notSupportedError.md +81 -0
- package/src/docs/custom/error/constructor/opts/unknownPropertyError.md +82 -0
- package/src/docs/custom/error/error.md +36 -0
- package/src/docs/custom/utils/clamp.md +45 -0
- package/src/docs/custom/utils/constructorOrTypeOf.md +39 -0
- package/src/docs/custom/utils/generator/generator.md +59 -0
- package/src/docs/custom/utils/generator/methods/generator.newToken.md +35 -0
- package/src/docs/custom/utils/generator/methods/generator.randomCharacters.md +35 -0
- package/src/docs/custom/utils/generator/methods/generator.randomInteger.md +41 -0
- package/src/docs/custom/utils/nameOf.md +39 -0
- package/src/types/api/api.d.ts +27 -9
- package/src/types/custom/error/builder/error.builder.d.ts +1 -1
- package/src/types/custom/error/constructor/error.custom.d.ts +24 -8
- package/src/types/custom/error/constructor/error.meta.d.ts +6 -6
- package/src/types/global.d.ts +3 -3
- package/src/utils/Arithmetic/arithmetic.js +0 -0
- package/src/utils/Arithmetic/operations/operation.divide.js +79 -0
- package/src/utils/Arithmetic/operations/operation.multiply.js +79 -0
- package/src/utils/Arithmetic/operations/operation.subtract.js +76 -0
- package/src/utils/Arithmetic/operations/operation.sum.js +76 -0
- package/src/utils/custom/error/builder/error.builder.js +3 -3
- package/src/utils/custom/error/error.js +2 -2
- package/src/utils/custom/utils/custom.utils.js +3 -3
- package/src/utils/custom/utils/generator/generator.js +4 -4
- package/src/utils/dom/attr/attr.class.js +4 -4
- package/src/utils/dom/attr/attr.id.js +3 -3
- package/src/utils/dom/attr/attr.style.js +5 -5
- package/src/utils/dom/element/create/element.create.js +14 -14
- package/src/utils/dom/element/getElementBy/dom.getElementBy.js +6 -6
- package/src/utils/dom/element/query/dom.query.js +3 -3
- package/src/utils/dom/element/tag-verifier/verifier.js +5 -5
- package/src/utils/dom/lifecycle/mount.js +3 -3
- package/src/utils/dom/lifecycle/unmount.js +2 -2
- package/src/utils/storage/local/storage.local.js +3 -3
- package/src/utils/storage/session/storage.session.js +3 -3
- package/src/utils/storage/storage.js +2 -2
- package/src/utils/variables.js +13 -7
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.MissingPropertyError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.MissingPropertyError()](#jsu---error-api---constructorsmissingpropertyerror)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameter](#parameter)
|
|
9
|
+
- [Properties](#properties)
|
|
10
|
+
- [Example Usage](#example-usage)
|
|
11
|
+
- [Navigate To](#navigate-to)
|
|
12
|
+
|
|
13
|
+
## What it does?
|
|
14
|
+
|
|
15
|
+
- It raises a report on your project's runtime about a missing property of a certain object.
|
|
16
|
+
|
|
17
|
+
## Parameter
|
|
18
|
+
|
|
19
|
+
- `meta` - The meta data object of this error.
|
|
20
|
+
- `meta.Message` - The message of this error. ( **_Required_** )
|
|
21
|
+
- `meta.Context` - The meta context object of this error.
|
|
22
|
+
- `meta.Context.Message` - A context message that points the root cause of error.
|
|
23
|
+
- `meta.Context.Emitter` - The source id of an object that is responsible of raising this error.
|
|
24
|
+
- `meta.Args` - A meta argument object of this error to check the reported arguments.
|
|
25
|
+
- `meta.Args.Id` - The reported argument id that cause this error.
|
|
26
|
+
- `meta.Args.PropertyId` - The missing property id of the argument.
|
|
27
|
+
- `Guide` - A guide for fixing this error.
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
- `Message` - The message of this error.
|
|
32
|
+
- `Context` - The context object of this error.
|
|
33
|
+
- `Args` - The arguments object of this error.
|
|
34
|
+
- `Guide` - A provided guide for fixing this error.
|
|
35
|
+
- `TimeStamp` - A record of date & time of when this error has occurred.
|
|
36
|
+
|
|
37
|
+
## Example Usage
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const User = {
|
|
41
|
+
Id: 0,
|
|
42
|
+
Name: "Carl Aaron ...",
|
|
43
|
+
Address: "...",
|
|
44
|
+
Age: 21,
|
|
45
|
+
};
|
|
46
|
+
const UserProps = ["Id", "Name", "Address", "Age", "Greet"];
|
|
47
|
+
for (const prop of UserProps.keys) {
|
|
48
|
+
if (!Object.hasOwn(prop))
|
|
49
|
+
throw new ERROR.Constructors.MissingPropertyError({
|
|
50
|
+
Message: "A missing property is found at User object!",
|
|
51
|
+
Context: {
|
|
52
|
+
Message: `User?.${prop}: Missing property!`,
|
|
53
|
+
Emitter: "foo"
|
|
54
|
+
},
|
|
55
|
+
Args: {
|
|
56
|
+
Id: "User",
|
|
57
|
+
PropertyId: prop
|
|
58
|
+
},
|
|
59
|
+
Guide: `Ensure to provide property '${prop}' at User object!`
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// #: Uncaught MissingPropertyError: ...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Navigate To
|
|
67
|
+
|
|
68
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
69
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
70
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
71
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
72
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
73
|
+
- [MissingParameterError()](./missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
74
|
+
- [NoSuchElementTagError()](./noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
75
|
+
- [NotSupportedError()](./notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
76
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
77
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
78
|
+
|
|
79
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
80
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
81
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.NoSuchElementTagError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.NoSuchElementTagError()](#jsu---error-api---constructorsnosuchelementtagerror)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameter](#parameter)
|
|
9
|
+
- [Properties](#properties)
|
|
10
|
+
- [Example Usage](#example-usage)
|
|
11
|
+
- [Navigate To](#navigate-to)
|
|
12
|
+
|
|
13
|
+
## What it does?
|
|
14
|
+
|
|
15
|
+
- It raises a report on your project's runtime about a provided unknown or not-qualified element's tag of `Element`.
|
|
16
|
+
|
|
17
|
+
## Parameter
|
|
18
|
+
|
|
19
|
+
- `meta` - The meta data object of this error.
|
|
20
|
+
- `meta.Message` - The message of this error. ( **_Required_** )
|
|
21
|
+
- `meta.Context` - The meta context object of this error.
|
|
22
|
+
- `meta.Context.Message` - A context message that points the root cause of error.
|
|
23
|
+
- `meta.Context.Emitter` - The source id of an object that is responsible of raising this error.
|
|
24
|
+
- `meta.Args` - A meta argument object of this error to check the reported arguments.
|
|
25
|
+
- `meta.Args.Id` - The reported argument id that cause this error.
|
|
26
|
+
- `meta.Args.Tag` - The provided unknown or not-qualified tag of element.
|
|
27
|
+
- `meta.Args.TagOf` - The element type or instance that does not have the provided tag. (Options: **_HTMLElement_**, **_MathMLElement_**, **_SVGElement_**)
|
|
28
|
+
- `Guide` - A guide for fixing this error.
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
- `Message` - The message of this error.
|
|
33
|
+
- `Context` - The context object of this error.
|
|
34
|
+
- `Args` - The arguments object of this error.
|
|
35
|
+
- `Guide` - A provided guide for fixing this error.
|
|
36
|
+
- `TimeStamp` - A record of date & time of when this error has occurred.
|
|
37
|
+
|
|
38
|
+
## Example Usage
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
function CreateElement(tag) {
|
|
42
|
+
if (tag === null || tag === undefined || typeof tag !== "string" || tag.trim().length === 0) return null;
|
|
43
|
+
|
|
44
|
+
// #: VariablesAPI.HTMLElementTags - Provided collection of HTMLElements tag.
|
|
45
|
+
if (!Variables.HTMLElementTags.has(tag))
|
|
46
|
+
throw new ERROR.Constructor.NoSuchElementTag({
|
|
47
|
+
Message: `A not-qualified HTMLElement tag is found at CreateElement()!`,
|
|
48
|
+
Context: {
|
|
49
|
+
Message: `CreateElement(@tag: ${tag}): Unknown HTMLElement Tag`,
|
|
50
|
+
Emitter: "CreateElement",
|
|
51
|
+
},
|
|
52
|
+
Args: {
|
|
53
|
+
Id: "tag",
|
|
54
|
+
Tag: tag,
|
|
55
|
+
TagOf: "HTMLElement",
|
|
56
|
+
},
|
|
57
|
+
Guide: "Ensure to provided a qualified HTMLElement tag!",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return document.createElement(tag);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
CreateElement("dib"); // Uncaught NoSuchElementTagError: ...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Navigate To
|
|
67
|
+
|
|
68
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
69
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
70
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
71
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
72
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
73
|
+
- [MissingParameterError()](./missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
74
|
+
- [MissingPropertyError()](./missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
75
|
+
- [NotSupportedError()](./notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
76
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
77
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
78
|
+
|
|
79
|
+
- [JSU - README](../../../../../../README.MD) - _JSU Homepage Documentation._
|
|
80
|
+
- [APIs](../../../../api/api.md) - \*A complete collection list of available APIs of **_JSU_**.\*
|
|
81
|
+
- [Custom](../../../custom.md) - _An API that provides a collection of customized and/or enhanced utilities or objects._
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.NotSupportedError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.NotSupportedError()](#jsu---error-api---constructorsnotsupportederror)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameter](#parameter)
|
|
9
|
+
- [Properties](#properties)
|
|
10
|
+
- [Example Usage](#example-usage)
|
|
11
|
+
- [Navigate To](#navigate-to)
|
|
12
|
+
|
|
13
|
+
## What it does?
|
|
14
|
+
|
|
15
|
+
- It raises a report on your project's runtime when a certain functions, methods, or API are was accessed but not supported.
|
|
16
|
+
|
|
17
|
+
## Parameter
|
|
18
|
+
|
|
19
|
+
- `meta` - The meta data object of this error.
|
|
20
|
+
- `meta.Message` - The message of this error. ( **_Required_** )
|
|
21
|
+
- `meta.Context` - The meta context object of this error.
|
|
22
|
+
- `meta.Context.Message` - A context message that points the root cause of error.
|
|
23
|
+
- `meta.Context.Emitter` - The source id of an object that is responsible of raising this error.
|
|
24
|
+
- `meta.Args` - A meta argument object of this error to check the reported arguments.
|
|
25
|
+
- `meta.Args.Id` - The object id that is being access but not supported.
|
|
26
|
+
- `Guide` - A guide for fixing this error.
|
|
27
|
+
|
|
28
|
+
## Properties
|
|
29
|
+
|
|
30
|
+
- `Message` - The message of this error.
|
|
31
|
+
- `Context` - The context object of this error.
|
|
32
|
+
- `Args` - The arguments object of this error.
|
|
33
|
+
- `Guide` - A provided guide for fixing this error.
|
|
34
|
+
- `TimeStamp` - A record of date & time of when this error has occurred.
|
|
35
|
+
|
|
36
|
+
## Example Usage
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const IsLocalStorageAPISupported = (function () {
|
|
40
|
+
try {
|
|
41
|
+
const Key = "__TEST_KEY__";
|
|
42
|
+
localStorage.setItem(Key, "__TEST__");
|
|
43
|
+
localStorage.removeItem(Key);
|
|
44
|
+
|
|
45
|
+
return true;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
})()
|
|
50
|
+
|
|
51
|
+
// #: Will throw when your or user's environment does not support LocalStorageAPI.
|
|
52
|
+
if (!IsLocalStorageAPISupported)
|
|
53
|
+
throw new ERROR.Constructors.NotSupportedError({
|
|
54
|
+
Message: "LocalStorageAPI is not supported!",
|
|
55
|
+
Context: {
|
|
56
|
+
Message: "LocalStorageAPI is not currently supported on user's current browser environment!",
|
|
57
|
+
Emitter: "foo"
|
|
58
|
+
},
|
|
59
|
+
Args: {
|
|
60
|
+
Id: "LocalStorage"
|
|
61
|
+
},
|
|
62
|
+
Guide: "Try to update your current browser environment to its latest update or switch to another browser such as 'Chrome', 'FireFox' or 'Brave'."
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Navigate To
|
|
67
|
+
|
|
68
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
69
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
70
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
71
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
72
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
73
|
+
- [MissingParameterError()](./missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
74
|
+
- [MissingPropertyError()](./missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
75
|
+
- [NoSuchElementTagError()](./noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
76
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
77
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
78
|
+
|
|
79
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
80
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
81
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.UnknownPropertyError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.UnknownPropertyError()](#jsu---error-api---constructorsunknownpropertyerror)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameter](#parameter)
|
|
9
|
+
- [Properties](#properties)
|
|
10
|
+
- [Example Usage](#example-usage)
|
|
11
|
+
- [Navigate To](#navigate-to)
|
|
12
|
+
|
|
13
|
+
## What it does?
|
|
14
|
+
|
|
15
|
+
- It raises a report on your project's runtime about a property that is not existing on a certain object.
|
|
16
|
+
|
|
17
|
+
## Parameter
|
|
18
|
+
|
|
19
|
+
- `meta` - The meta data object of this error.
|
|
20
|
+
- `meta.Message` - The message of this error. ( **_Required_** )
|
|
21
|
+
- `meta.Context` - The meta context object of this error.
|
|
22
|
+
- `meta.Context.Message` - A context message that points the root cause of error.
|
|
23
|
+
- `meta.Context.Emitter` - The source id of an object that is responsible of raising this error.
|
|
24
|
+
- `meta.Args` - A meta argument object of this error to check the reported arguments.
|
|
25
|
+
- `meta.Args.Id` - The reported argument id that cause this error.
|
|
26
|
+
- `meta.Args.PropertyId` - The unknown property that is trying to be accessed.
|
|
27
|
+
- `Guide` - A guide for fixing this error.
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
- `Message` - The message of this error.
|
|
32
|
+
- `Context` - The context object of this error.
|
|
33
|
+
- `Args` - The arguments object of this error.
|
|
34
|
+
- `Guide` - A provided guide for fixing this error.
|
|
35
|
+
- `TimeStamp` - A record of date & time of when this error has occurred.
|
|
36
|
+
|
|
37
|
+
## Example Usage
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
function GetPropertyOf(obj, prop) {
|
|
41
|
+
if (typeof obj !== "object" || Array.isArray(obj) || obj instanceof Map || obj instanceof Set)
|
|
42
|
+
throw new ERROR.Constructors.ArgumentError({...});
|
|
43
|
+
|
|
44
|
+
if (typeof prop !== "string")
|
|
45
|
+
throw new ERROR.Constructors.ArgumentError({...});
|
|
46
|
+
|
|
47
|
+
if (!Object.hasOwn(obj, prop))
|
|
48
|
+
throw new ERROR.Constructors.UnknownPropertyError({
|
|
49
|
+
Message: `Unknown property '${prop}' of 'obj'!`,
|
|
50
|
+
Context: {
|
|
51
|
+
Message: `GetPropertyOf(@obj.${prop}: UNKNOWN_PROPERTY)`,
|
|
52
|
+
Emitter: "GetPropertyOf"
|
|
53
|
+
},
|
|
54
|
+
Args: {
|
|
55
|
+
Id: "obj",
|
|
56
|
+
PropertyId: prop
|
|
57
|
+
},
|
|
58
|
+
Guide: "Ensure to provide only a existing property id of obj!"
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return obj[prop];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
GetPropertyOf({ pi: 3.14, n: 0 }, "p"); // Uncaught UnknownPropertyError: ...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Navigate To
|
|
68
|
+
|
|
69
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
70
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
71
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
72
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
73
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
74
|
+
- [MissingParameterError()](./missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
75
|
+
- [MissingPropertyError()](./missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
76
|
+
- [NoSuchElementTagError()](./noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
77
|
+
- [NotSupportedError()](./notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
78
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
79
|
+
|
|
80
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
81
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
82
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# JSU - ERROR API
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API](#jsu---error-api)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [Usage](#usage)
|
|
8
|
+
- [API Object](#api-object)
|
|
9
|
+
- [Properties](#properties)
|
|
10
|
+
- [Navigate To](#navigate-to)
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
// Loads all available JSU APIs from your project's runtime.
|
|
16
|
+
import "@carlsebastian/jsu";
|
|
17
|
+
|
|
18
|
+
// Only loads ERROR API of JSU from your project's runtime.
|
|
19
|
+
import "@carlsebastian/jsu/error";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## API Object
|
|
23
|
+
|
|
24
|
+
- `ERROR` | `globalThis.ERROR` | `window.ERROR` | `JSU.ERROR`
|
|
25
|
+
|
|
26
|
+
## Properties
|
|
27
|
+
|
|
28
|
+
- [Constructors](./constructor/error.constructor.md) - *A collection of customized error class constructors.*
|
|
29
|
+
- [Raise](./builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
30
|
+
|
|
31
|
+
## Navigate To
|
|
32
|
+
|
|
33
|
+
- [APIs](../../api/api.md) - *A complete collection list of available APIs of **JSU**.*
|
|
34
|
+
- [Custom](../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
35
|
+
|
|
36
|
+
- [JSU - README](../../../../README.MD) - *JSU Homepage Documentation.*
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# JSU - Custom API - Clamp()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - Clamp()](#jsu---custom-api---clamp)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What It Does?](#what-it-does)
|
|
8
|
+
- [Parameters](#parameters)
|
|
9
|
+
- [Example Usage](#example-usage)
|
|
10
|
+
- [Navigate To](#navigate-to)
|
|
11
|
+
|
|
12
|
+
## What It Does?
|
|
13
|
+
|
|
14
|
+
- `Custom.Clamp()` method ensures that the given numerical value would never fall or exceeds the given `minimum` and `maximum` range bounds. Once it does, it will automatically be clamped to those given bounds.
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
- `value` - The given current numeric value.
|
|
19
|
+
- `min` - The minimum range bound of the given numeric value.
|
|
20
|
+
- `max` - The maximum range bound of the given numeric value.
|
|
21
|
+
|
|
22
|
+
## Example Usage
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
// #: Ensures that the given index would never exceeds the length of an array.
|
|
26
|
+
const chars = ["a", "b", "c", "d", "e"];
|
|
27
|
+
const charPos = 10;
|
|
28
|
+
|
|
29
|
+
// #: Without clamp
|
|
30
|
+
console.log(chars[charPos]); // undefined - might cause an error or trouble on your project.
|
|
31
|
+
|
|
32
|
+
// #: With clamp
|
|
33
|
+
console.log(chars[Custom.Clamp(charPos, 0, chars.length - 1)]); // It would always resulted to 'e' it exceeds the maximum bound (4) or 'a' when falls the minimum bound.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Navigate To
|
|
37
|
+
|
|
38
|
+
- [Custom](../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
39
|
+
- [ConstructorOrTypeOf()](./constructorOrTypeOf.md) - *Retrieves the **constructor** or **type** of the given argument.*
|
|
40
|
+
- [Generator()](./generator/generator.md) - *A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.*
|
|
41
|
+
- [NameOf()](./nameOf.md) - *Retrieves the **name** property of the given object.*
|
|
42
|
+
|
|
43
|
+
- [JSU - README](../../../../README.MD) - *JSU Homepage Documentation.*
|
|
44
|
+
- [APIs](../../api/api.md) - *A complete collection of available APIs of **JSU**.*
|
|
45
|
+
- [ERROR](../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# JSU - Custom API - ConstructorOrTypeOf()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - ConstructorOrTypeOf()](#jsu---custom-api---constructorortypeof)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What It Does?](#what-it-does)
|
|
8
|
+
- [Parameter](#parameter)
|
|
9
|
+
- [Example Usage](#example-usage)
|
|
10
|
+
- [Navigate To](#navigate-to)
|
|
11
|
+
|
|
12
|
+
## What It Does?
|
|
13
|
+
|
|
14
|
+
- `Custom.ConstructorOrTypeOf()` checks and returns the `constructor` or `type` of the given argument, by default, it prioritize on checking and retrieving the `constructor` of the given argument and safely fallback on checking and retrieving the `type` of the given argument if `constructor` is not present.
|
|
15
|
+
|
|
16
|
+
## Parameter
|
|
17
|
+
|
|
18
|
+
- `arg` - The given argument to check and retrieve its `constructor` or `type`.
|
|
19
|
+
|
|
20
|
+
## Example Usage
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
const CTs = [{}, [], '', 0, new Map(), new Set].map(arg => {
|
|
24
|
+
return Custom.ConstructorOrTypeOf(arg);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
console.log(CTs); // #: [Object, Array, String, Number, Map, Set]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Navigate To
|
|
31
|
+
|
|
32
|
+
- [Custom](../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
33
|
+
- [Clamp()](./clamp.md) - Mutates the given numerical value within the given **minimum** and **maximum** range.
|
|
34
|
+
- [Generator()](./generator/generator.md) - A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.
|
|
35
|
+
- [NameOf()](./nameOf.md) - Retrieves the **name** property of the given object.
|
|
36
|
+
|
|
37
|
+
- [JSU - README](../../../../README.MD) - *JSU Homepage Documentation.*
|
|
38
|
+
- [APIs](../../api/api.md) - *A complete collection of available APIs of **JSU**.*
|
|
39
|
+
- [ERROR](../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# JSU - Custom API - Generator()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - Generator()](#jsu---custom-api---generator)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What It Does?](#what-it-does)
|
|
8
|
+
- [Parameters](#parameters)
|
|
9
|
+
- [Properties / Methods](#properties--methods)
|
|
10
|
+
- [Example Usage](#example-usage)
|
|
11
|
+
- [Navigate To](#navigate-to)
|
|
12
|
+
|
|
13
|
+
## What It Does?
|
|
14
|
+
|
|
15
|
+
- Provides a pre-made random generator methods which can be use on however you use it such as game's token session, lobby token, and more!
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
- `size` - The size of generator's contents to generate.
|
|
20
|
+
- `conf` - A configuration for customizing the contents of generators and secureness of this generator's contents.
|
|
21
|
+
- `conf.lowercase` - Accepts a `boolean` state, and determines whether to include or exclude lowercase characters from generator's contents. (`a-z`)
|
|
22
|
+
- `conf.numbers` - Accepts a `boolean` state, and determines whether to include or exclude numerical characters from generator's contents. (`0-9`)
|
|
23
|
+
- `conf.secure` - Accepts a `boolean` state, and determines the entropy to use for generating the generator's contents. (`crypto` | `Math.random()`)
|
|
24
|
+
- `conf.symbols` - Accepts a `boolean` state, and determines whether to include or exclude symbol characters from generator's contents. (`~!@#$%^&*()-_+=`...)
|
|
25
|
+
- `conf.uppercase` - Accepts a `boolean` state, and determines whether to include or exclude uppercase characters from generator's contents. (`A-Z`)
|
|
26
|
+
|
|
27
|
+
## Properties / Methods
|
|
28
|
+
|
|
29
|
+
- [NewToken()](./methods/generator.newToken.md) - Generates a randomized sequence of characters of `A-Z`, `a-z`, `0-9` and `symbols`
|
|
30
|
+
- [RandomCharacters()](./methods/generator.randomCharacters.md) - Generates a sequence of randomized characters of `A-Z` and/or `a-z`.
|
|
31
|
+
- [RandomInteger()](./methods/generator.randomInteger.md) - Generates a randomized integer value from the given `minimum` and `maximum` range.
|
|
32
|
+
|
|
33
|
+
## Example Usage
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const Generate = new Custom.Generator(10, { secure: true });
|
|
37
|
+
|
|
38
|
+
// #: Generate a sequence of randomized token that can be use for security such as session id, validation token, etc.
|
|
39
|
+
// #: Only when configuration's 'secure' property is enabled.
|
|
40
|
+
const Token = Generate.NewToken();
|
|
41
|
+
|
|
42
|
+
// #: Generate a sequence of randomized characters that can be used for security such as session id, validation token, etc.
|
|
43
|
+
// #: Only when configuration's 'secure' property is enabled.
|
|
44
|
+
const CToken = Generate.RandomCharacters();
|
|
45
|
+
|
|
46
|
+
// #: Generate a randomized integer value.
|
|
47
|
+
const RInt = Generate.RandomInteger();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Navigate To
|
|
51
|
+
|
|
52
|
+
- [Custom](../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
53
|
+
- [Clamp()](../clamp.md) - *Mutates the given numerical value within the given **minimum** and **maximum** range.*
|
|
54
|
+
- [ConstructorOrTypeOf()](../constructorOrTypeOf.md) - *Retrieves the **constructor** or **type** of the given argument.*
|
|
55
|
+
- [NameOf()](../nameOf.md) - *Retrieves the **name** property of the given object.*
|
|
56
|
+
|
|
57
|
+
- [JSU - README](../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
58
|
+
- [APIs](../../../api/api.md) - *A complete collection of available APIs of **JSU**.*
|
|
59
|
+
- [ERROR](../../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# JSU - Custom API - Generator().NewToken()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - Generator().NewToken()](#jsu---custom-api---generatornewtoken)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What It Does?](#what-it-does)
|
|
8
|
+
- [Example Usage](#example-usage)
|
|
9
|
+
- [Navigate To](#navigate-to)
|
|
10
|
+
|
|
11
|
+
## What It Does?
|
|
12
|
+
|
|
13
|
+
- `Generator().NewToken()` Generates a sequence of random characters which can be used as session id, data id, game lobby id, and more.
|
|
14
|
+
|
|
15
|
+
## Example Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const Generate = new Custom.Generator(10, { secure: true, lowercase: false }); // Base size and configuration to use from generators.
|
|
19
|
+
|
|
20
|
+
const VToken = Generate.NewToken(); // Generated token with symbols, numbers, and uppercase only.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Navigate To
|
|
24
|
+
|
|
25
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
26
|
+
- [Clamp()](../../clamp.md) - *Mutates the given numerical value within the given **minimum** and **maximum** range.*
|
|
27
|
+
- [ConstructorOrTypeOf()](../../constructorOrTypeOf.md) - *Retrieves the **constructor** or **type** of the given argument.*
|
|
28
|
+
- [NameOf()](../../nameOf.md) - *Retrieves the **name** property of the given object.*
|
|
29
|
+
- [Generator()](../generator.md) - *A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.*
|
|
30
|
+
- [RandomCharacters()](./generator.randomCharacters.md) - *Generates a sequence of randomized characters of **A-Z** and/or **a-z**.*
|
|
31
|
+
- [RandomInteger()](./generator.randomInteger.md) - *Generates a randomized integer value from the given **minimum** and **maximum** range.*
|
|
32
|
+
|
|
33
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
34
|
+
- [APIs](../../../../api/api.md) - *A complete collection of available APIs of **JSU**.*
|
|
35
|
+
- [ERROR](../../../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# JSU - Custom API - Generator().RandomCharacters()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - Generator().RandomCharacters()](#jsu---custom-api---generatorrandomcharacters)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Example Usage](#example-usage)
|
|
9
|
+
- [Navigate To](#navigate-to)
|
|
10
|
+
|
|
11
|
+
## What it does?
|
|
12
|
+
|
|
13
|
+
- `Generator().RandomCharacters()` generates a sequence of characters of `A-Z` and/or `a-z`. Its contents will be based on the given configuration at `Generator()`.
|
|
14
|
+
|
|
15
|
+
## Example Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const Generate = new Custom.Generator(10, { secure: true });
|
|
19
|
+
|
|
20
|
+
const VChars = Generate.RandomCharacters(); // Generates random sequence of characters that consist both upper and lower case characters.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Navigate To
|
|
24
|
+
|
|
25
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
26
|
+
- [Clamp()](../../clamp.md) - *Mutates the given numerical value within the given **minimum** and **maximum** range.*
|
|
27
|
+
- [ConstructorOrTypeOf()](../../constructorOrTypeOf.md) - *Retrieves the **constructor** or **type** of the given argument.*
|
|
28
|
+
- [NameOf()](../../nameOf.md) - *Retrieves the **name** property of the given object.*
|
|
29
|
+
- [Generator()](../generator.md) - *A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.*
|
|
30
|
+
- [NewToken()](./generator.newToken.md) - *Generates a randomized sequence of characters of **A-Z**, **a-z**, **0-9** and **symbols**.*
|
|
31
|
+
- [RandomInteger()](./generator.randomInteger.md) - *Generates a randomized integer value from the given **minimum** and **maximum** range.*
|
|
32
|
+
|
|
33
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
34
|
+
- [APIs](../../../../api/api.md) - *A complete collection of available APIs of **JSU**.*
|
|
35
|
+
- [ERROR](../../../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# JSU - Custom API - Generator().RandomInteger()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - Generator().RandomInteger()](#jsu---custom-api---generatorrandominteger)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameters](#parameters)
|
|
9
|
+
- [Example Usage](#example-usage)
|
|
10
|
+
- [Navigate To](#navigate-to)
|
|
11
|
+
|
|
12
|
+
## What it does?
|
|
13
|
+
|
|
14
|
+
- `Generator().RandomInteger(min, max)` generates a random integer value within the given `minimum` and `maximum` range.
|
|
15
|
+
|
|
16
|
+
## Parameters
|
|
17
|
+
|
|
18
|
+
- `min` - The minimum integer value of this generator can generate.
|
|
19
|
+
- `max` - The maximum integer value of this generator can generate.
|
|
20
|
+
|
|
21
|
+
## Example Usage
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
const Generate = new Custom.Generator(10, { secure: true });
|
|
25
|
+
|
|
26
|
+
console.log(Generate.RandomInteger(0, 10)); // Logs the generated random integer value within the given range.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Navigate To
|
|
30
|
+
|
|
31
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
32
|
+
- [Clamp()](../../clamp.md) - *Mutates the given numerical value within the given **minimum** and **maximum** range.*
|
|
33
|
+
- [ConstructorOrTypeOf()](../../constructorOrTypeOf.md) - *Retrieves the **constructor** or **type** of the given argument.*
|
|
34
|
+
- [NameOf()](../../nameOf.md) - *Retrieves the **name** property of the given object.*
|
|
35
|
+
- [Generator()](../generator.md) - *A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.*
|
|
36
|
+
- [NewToken()](./generator.newToken.md) - *Generates a randomized sequence of characters of **A-Z**, **a-z**, **0-9** and **symbols**.*
|
|
37
|
+
- [RandomCharacters()](./generator.randomCharacters.md) - *Generates a sequence of randomized characters of **A-Z** and/or **a-z**.*
|
|
38
|
+
|
|
39
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
40
|
+
- [APIs](../../../../api/api.md) - *A complete collection of available APIs of **JSU**.*
|
|
41
|
+
- [ERROR](../../../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# JSU - Custom API - NameOf()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - Custom API - NameOf()](#jsu---custom-api---nameof)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameter](#parameter)
|
|
9
|
+
- [Example Usage](#example-usage)
|
|
10
|
+
- [Navigate To](#navigate-to)
|
|
11
|
+
|
|
12
|
+
## What it does?
|
|
13
|
+
|
|
14
|
+
- `NameOf()` checks and retrieves the `name` property of the specified or given object in any case format.
|
|
15
|
+
|
|
16
|
+
## Parameter
|
|
17
|
+
|
|
18
|
+
- `obj` - The specified or given object to retrieve its `name` property.
|
|
19
|
+
|
|
20
|
+
## Example Usage
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
const Os = [{ name: "o1" }, { NaMe: "o2" }, { NAme: "o3" }, { naME: "o4" }, { nAMe: "o5" }];
|
|
24
|
+
|
|
25
|
+
for (const O of Os) {
|
|
26
|
+
console.log(Custom.NameOf(O)); // "o1" to "o5"
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Navigate To
|
|
31
|
+
|
|
32
|
+
- [Custom](../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
33
|
+
- [Clamp()](./clamp.md) - Mutates the given numerical value within the given **minimum** and **maximum** range.
|
|
34
|
+
- [ConstructorOrTypeOf()](./constructorOrTypeOf.md) - Retrieves the **constructor** or **`type`** of the given argument.
|
|
35
|
+
- [Generator()](./generator/generator.md) - A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.
|
|
36
|
+
|
|
37
|
+
- [JSU - README](../../../../README.MD) - *JSU Homepage Documentation.*
|
|
38
|
+
- [APIs](../../api/api.md) - *A complete collection list of available APIs of **JSU**.*
|
|
39
|
+
- [ERROR](../error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|