@carlsebastian/jsu 1.0.50 → 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 +1 -1
- package/package.json +1 -1
- package/src/docs/api/api.md +3 -2
- package/src/docs/custom/custom.md +13 -33
- 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 +8 -6
- package/src/docs/custom/utils/constructorOrTypeOf.md +8 -6
- package/src/docs/custom/utils/generator/generator.md +8 -6
- package/src/docs/custom/utils/generator/methods/generator.newToken.md +11 -8
- package/src/docs/custom/utils/generator/methods/generator.randomCharacters.md +11 -8
- package/src/docs/custom/utils/generator/methods/generator.randomInteger.md +11 -8
- package/src/docs/custom/utils/nameOf.md +8 -6
- 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
|
@@ -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.*
|
|
@@ -35,9 +35,11 @@ console.log(chars[Custom.Clamp(charPos, 0, chars.length - 1)]); // It would alwa
|
|
|
35
35
|
|
|
36
36
|
## Navigate To
|
|
37
37
|
|
|
38
|
-
- [Custom](../custom.md) -
|
|
39
|
-
- [ConstructorOrTypeOf()](./constructorOrTypeOf.md) - Retrieves the
|
|
40
|
-
- [Generator()](./generator/generator.md) - A customized generator constructor for generating randomized
|
|
41
|
-
- [NameOf()](./nameOf.md) - Retrieves the
|
|
42
|
-
|
|
43
|
-
- [JSU - README](../../../../README.MD) - JSU
|
|
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.*
|
|
@@ -29,9 +29,11 @@ console.log(CTs); // #: [Object, Array, String, Number, Map, Set]
|
|
|
29
29
|
|
|
30
30
|
## Navigate To
|
|
31
31
|
|
|
32
|
-
- [Custom](../custom.md) -
|
|
33
|
-
- [Clamp()](./clamp.md) - Mutates the given numerical value within the given
|
|
34
|
-
- [Generator()](./generator/generator.md) - A customized generator constructor for generating randomized
|
|
35
|
-
- [NameOf()](./nameOf.md) - Retrieves the
|
|
36
|
-
|
|
37
|
-
- [JSU - README](../../../../README.MD) - JSU
|
|
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.*
|
|
@@ -49,9 +49,11 @@ const RInt = Generate.RandomInteger();
|
|
|
49
49
|
|
|
50
50
|
## Navigate To
|
|
51
51
|
|
|
52
|
-
- [Custom](../../custom.md) -
|
|
53
|
-
- [Clamp()](../clamp.md) - Mutates the given numerical value within the given
|
|
54
|
-
- [ConstructorOrTypeOf()](../constructorOrTypeOf.md) - Retrieves the
|
|
55
|
-
- [NameOf()](../nameOf.md) - Retrieves the
|
|
56
|
-
|
|
57
|
-
- [JSU - README](../../../../../README.MD) - JSU
|
|
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.*
|
|
@@ -22,11 +22,14 @@ const VToken = Generate.NewToken(); // Generated token with symbols, numbers, an
|
|
|
22
22
|
|
|
23
23
|
## Navigate To
|
|
24
24
|
|
|
25
|
-
- [Custom](../../../custom.md) -
|
|
26
|
-
- [Clamp()](../../clamp.md) - Mutates the given numerical value within the given
|
|
27
|
-
- [ConstructorOrTypeOf()](../../constructorOrTypeOf.md) - Retrieves the
|
|
28
|
-
- [
|
|
29
|
-
|
|
30
|
-
- [
|
|
31
|
-
|
|
32
|
-
|
|
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.*
|
|
@@ -22,11 +22,14 @@ const VChars = Generate.RandomCharacters(); // Generates random sequence of char
|
|
|
22
22
|
|
|
23
23
|
## Navigate To
|
|
24
24
|
|
|
25
|
-
- [Custom](../../../custom.md) -
|
|
26
|
-
- [Clamp()](../../clamp.md) - Mutates the given numerical value within the given
|
|
27
|
-
- [ConstructorOrTypeOf()](../../constructorOrTypeOf.md) - Retrieves the
|
|
28
|
-
- [
|
|
29
|
-
|
|
30
|
-
- [
|
|
31
|
-
|
|
32
|
-
|
|
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.*
|
|
@@ -28,11 +28,14 @@ console.log(Generate.RandomInteger(0, 10)); // Logs the generated random integer
|
|
|
28
28
|
|
|
29
29
|
## Navigate To
|
|
30
30
|
|
|
31
|
-
- [Custom](../../../custom.md) -
|
|
32
|
-
- [Clamp()](../../clamp.md) - Mutates the given numerical value within the given
|
|
33
|
-
- [ConstructorOrTypeOf()](../../constructorOrTypeOf.md) - Retrieves the
|
|
34
|
-
- [
|
|
35
|
-
|
|
36
|
-
- [
|
|
37
|
-
|
|
38
|
-
|
|
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.*
|
|
@@ -29,9 +29,11 @@ for (const O of Os) {
|
|
|
29
29
|
|
|
30
30
|
## Navigate To
|
|
31
31
|
|
|
32
|
-
- [Custom](../custom.md) -
|
|
33
|
-
- [Clamp()](./clamp.md) - Mutates the given numerical value within the given
|
|
34
|
-
- [ConstructorOrTypeOf()](./constructorOrTypeOf.md) - Retrieves the
|
|
35
|
-
- [Generator()](./generator/generator.md) - A customized generator constructor for generating randomized
|
|
36
|
-
|
|
37
|
-
- [JSU - README](../../../../README.MD) - JSU
|
|
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.*
|
package/src/types/api/api.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ interface DomAPI {
|
|
|
112
112
|
|
|
113
113
|
interface ErrorAPI {
|
|
114
114
|
Constructors: ErrorConstructorAPI;
|
|
115
|
-
|
|
115
|
+
Raise: ErrorRaiseAPI;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
type GuardsAPI = GuardsDataTypesAPI & GuardsFormatAPI;
|
|
@@ -136,12 +136,30 @@ interface StorageAPI {
|
|
|
136
136
|
SESSION: SessionStorageAPI;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
interface
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
interface VariablesAPI {
|
|
140
|
+
/**
|
|
141
|
+
* A collection of `HTMLElement` tags name.
|
|
142
|
+
*
|
|
143
|
+
* ***Source***: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements
|
|
144
|
+
*/
|
|
145
|
+
HTMLElementTags: Map<keyof HTMLElementTags, { Generate(): HTMLElement; }>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* A collection of `SVGElement` tags name.
|
|
149
|
+
*
|
|
150
|
+
* ***Source***: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element
|
|
151
|
+
*/
|
|
152
|
+
SVGElementTags: Map<keyof SVGElementTags, { Generate(): SVGElement; }>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A collection of `MathMLElement` tags name.
|
|
156
|
+
*
|
|
157
|
+
* ***Source***: https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element
|
|
158
|
+
*/
|
|
159
|
+
MathElementTags: Map<keyof MathElementTags, { Generate(): MathMLElement; }>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A collection of available XML namespace of elements.
|
|
163
|
+
*/
|
|
164
|
+
XMLNameSpace: ["http://www.w3.org/1998/Math/MathML", "http://www.w3.org/1999/xhtml", "http://www.w3.org/2000/svg"];
|
|
147
165
|
}
|
|
@@ -2,33 +2,49 @@ type ErrorConstructorAPI = {
|
|
|
2
2
|
/**
|
|
3
3
|
* A customized and enhanced `TypeError`.
|
|
4
4
|
*/
|
|
5
|
-
ArgumentError:
|
|
5
|
+
ArgumentError: {
|
|
6
|
+
new (meta: ArgumentErrorMeta): ArgumentErrorMeta;
|
|
7
|
+
};
|
|
6
8
|
/**
|
|
7
9
|
* A customized and enhanced `RangeError`.
|
|
8
10
|
*/
|
|
9
|
-
IndexOutOfBoundsError:
|
|
11
|
+
IndexOutOfBoundsError: {
|
|
12
|
+
new (meta: IndexOutOfBoundsErrorMeta): IndexOutOfBoundsErrorMeta;
|
|
13
|
+
};
|
|
10
14
|
/**
|
|
11
15
|
* A customized error for invalid properties.
|
|
12
16
|
*/
|
|
13
|
-
InvalidPropertyError:
|
|
17
|
+
InvalidPropertyError: {
|
|
18
|
+
new (meta: InvalidPropertyErrorMeta): InvalidPropertyErrorMeta;
|
|
19
|
+
};
|
|
14
20
|
/**
|
|
15
21
|
* A customized error for missing parameter value.
|
|
16
22
|
*/
|
|
17
|
-
MissingParameterError:
|
|
23
|
+
MissingParameterError: {
|
|
24
|
+
new (meta: MissingParameterErrorMeta): MissingParameterErrorMeta;
|
|
25
|
+
};
|
|
18
26
|
/**
|
|
19
27
|
* A customized error for missing property.
|
|
20
28
|
*/
|
|
21
|
-
MissingPropertyError:
|
|
29
|
+
MissingPropertyError: {
|
|
30
|
+
new (meta: MissingPropertyError): MissingPropertyError;
|
|
31
|
+
};
|
|
22
32
|
/**
|
|
23
33
|
* A customized error for unqualified element's tag.
|
|
24
34
|
*/
|
|
25
|
-
NoSuchElementTagError:
|
|
35
|
+
NoSuchElementTagError: {
|
|
36
|
+
new (meta: NoSuchElementTagErrorMeta): NoSuchElementTagErrorMeta;
|
|
37
|
+
};
|
|
26
38
|
/**
|
|
27
39
|
* A customized error for not supported objects, etc.
|
|
28
40
|
*/
|
|
29
|
-
NotSupportedError:
|
|
41
|
+
NotSupportedError: {
|
|
42
|
+
new (meta: NotSupportedErrorMeta): NotSupportedErrorMeta;
|
|
43
|
+
};
|
|
30
44
|
/**
|
|
31
45
|
* A customized error for unknown property.
|
|
32
46
|
*/
|
|
33
|
-
UnknownPropertyError:
|
|
47
|
+
UnknownPropertyError: {
|
|
48
|
+
new (meta: UnknownPropertyErrorMeta): UnknownPropertyErrorMeta;
|
|
49
|
+
};
|
|
34
50
|
}
|
|
@@ -10,9 +10,9 @@ type BaseMeta<OtherArguments extends {} = {}> = {
|
|
|
10
10
|
|
|
11
11
|
type ArgumentErrorMeta = BaseMeta<{ ReceivedArgument: string, ExpectedArguments: string[] }>;
|
|
12
12
|
type IndexOutOfBoundsErrorMeta = BaseMeta<{ Index: number, MaxBound: number }>;
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
type
|
|
17
|
-
type
|
|
18
|
-
type
|
|
13
|
+
type InvalidPropertyErrorMeta = BaseMeta<{ PropertyId: string }>;
|
|
14
|
+
type MissingParameterErrorMeta = BaseMeta<{ Value: string }>;
|
|
15
|
+
type MissingPropertyErrorMeta = BaseMeta<{ PropertyId: string }>;
|
|
16
|
+
type NoSuchElementTagErrorMeta = BaseMeta<{ Tag: string, TagOf: "HTMLElement" | "MathMLElement" | "SVGElement" }>;
|
|
17
|
+
type NotSupportedErrorMeta = BaseMeta;
|
|
18
|
+
type UnknownPropertyErrorMeta = BaseMeta<{ PropertyId: string }>;
|
package/src/types/global.d.ts
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
/// <reference types="./storage/storage.d.ts" />
|
|
9
9
|
|
|
10
10
|
declare global {
|
|
11
|
-
readonly var Utils: EnhancedGlobalUtilsAPI;
|
|
12
|
-
readonly var DOM: DomAPI;
|
|
13
11
|
readonly var Custom: CustomAPI;
|
|
12
|
+
readonly var DOM: DomAPI;
|
|
14
13
|
readonly var ERROR: ErrorAPI;
|
|
14
|
+
readonly var GetElementBy: DOMGetElementByAPI;
|
|
15
15
|
readonly var Guards: GuardsAPI;
|
|
16
16
|
readonly var Primitives: PrimitivesAPI;
|
|
17
17
|
readonly var STORAGE: StorageAPI;
|
|
18
|
-
readonly var
|
|
18
|
+
readonly var Variables: VariablesAPI
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export { };
|
|
File without changes
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import Raise from '../../custom/error/builder/error.builder.js';
|
|
2
|
+
import { IsNum } from '../../guards/data-types/data-types.js';
|
|
3
|
+
import { MapOf } from '../../primitives/obj/obj.iterator.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Accumulates the total divided value of the given numerical values.
|
|
7
|
+
*
|
|
8
|
+
* @overload
|
|
9
|
+
* @param { number } num1 - The first and base numerical value of this operation.
|
|
10
|
+
* @param { number } num2 - The second numerical value to divide with the first numerical value.
|
|
11
|
+
* @returns { number } The total accumulated value of the given numerical values.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Accumulates the total divided value of the given numerical values.
|
|
15
|
+
*
|
|
16
|
+
* @overload
|
|
17
|
+
* @param { number } num1 - The first and base numerical value of this operation.
|
|
18
|
+
* @param { number } num2 - The second numerical value to divide with the first numerical value.
|
|
19
|
+
* @param { number } num3 - The third numerical value to divide with the first and second numerical value.
|
|
20
|
+
* @returns { number } The total accumulated value of the given numerical values.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Accumulates the total divided value of the given numerical values.
|
|
24
|
+
*
|
|
25
|
+
* @overload
|
|
26
|
+
* @param { number } num1 - The first and base numerical value of this operation.
|
|
27
|
+
* @param { number } num2 - The second numerical value to divide with the first numerical value.
|
|
28
|
+
* @param { number } num3 - The third numerical value to divide with the first and second numerical value.
|
|
29
|
+
* @param { number } num4 - The fourth numerical value to divide with the first, second, and third numerical value.
|
|
30
|
+
* @returns { number } The total accumulated value of the given numerical values.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Accumulates the total divided value of the given numerical values.
|
|
34
|
+
*
|
|
35
|
+
* @overload
|
|
36
|
+
* @param { number } num1 - The first and base numerical value of this operation.
|
|
37
|
+
* @param { number } num2 - The second numerical value to divide with the first numerical value.
|
|
38
|
+
* @param { number } num3 - The third numerical value to divide with the first and second numerical value.
|
|
39
|
+
* @param { number } num4 - The fourth numerical value to divide with the first, second, and third numerical value.
|
|
40
|
+
* @param { number } num5 - The fifth numerical value to divide with the first, second, third, and fourth numerical value.
|
|
41
|
+
* @returns { number } The total accumulated value of the given numerical values.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Accumulates the total divided value of the given numerical values.
|
|
45
|
+
*
|
|
46
|
+
* @overload
|
|
47
|
+
* @param { ...number } nums - The collection of numerical values to divide.
|
|
48
|
+
* @returns { number } The total accumulated value of the given numerical values.
|
|
49
|
+
*/
|
|
50
|
+
export default function Divide(...nums) {
|
|
51
|
+
const Method = "Divide", ICtr = nums.length, P = ["num1", "num2", "num3", "num4", "num5"];
|
|
52
|
+
|
|
53
|
+
if (ICtr < 2)
|
|
54
|
+
Raise._MissingParameterError(Method, P[ICtr], undefined);
|
|
55
|
+
|
|
56
|
+
if (ICtr === 2) {
|
|
57
|
+
const [A, B] = MapOf(nums, (num, pos) =>
|
|
58
|
+
!IsNum(parseInt(num, 10)) ? Raise._ArgumentError(Method, P[pos], num, "Number")
|
|
59
|
+
: parseInt(num, 10)
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return A === 0 ? NaN : A / B;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const Base = parseInt(nums[0], 10);
|
|
66
|
+
if (!IsNum(Base))
|
|
67
|
+
Raise._ArgumentError(Method, P[0], nums[0], "Number");
|
|
68
|
+
|
|
69
|
+
if (Base === 0)
|
|
70
|
+
return NaN;
|
|
71
|
+
|
|
72
|
+
return nums.slice(1).reduce((acc, num, pos) => {
|
|
73
|
+
const pN = parseInt(num, 10);
|
|
74
|
+
if (!IsNum(pN))
|
|
75
|
+
Raise._ArgumentError(Method, ICtr > 5 ? "nums" : P[pos + 1], num, "Number");
|
|
76
|
+
|
|
77
|
+
return acc /= pN;
|
|
78
|
+
}, Base);
|
|
79
|
+
}
|