@carlsebastian/jsu 1.0.50 → 1.1.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/README.MD +1 -1
- package/global.js +1 -1
- package/package.json +10 -2
- 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/arithmetic/arithmetic.d.ts +281 -0
- 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/custom/utils/custom.utils.d.ts +83 -0
- package/src/types/global.d.ts +5 -3
- package/src/utils/arithmetic/arithmetic.js +20 -0
- package/src/utils/arithmetic/operations/operation.divide.js +78 -0
- package/src/utils/arithmetic/operations/operation.multiply.js +75 -0
- package/src/utils/arithmetic/operations/operation.subtract.js +64 -0
- package/src/utils/arithmetic/operations/operation.sum.js +65 -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 +68 -4
- 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/README.MD
CHANGED
|
@@ -109,4 +109,4 @@ DOM.Mount(B, Anchor); // Now visible to document contents or user's view.
|
|
|
109
109
|
|
|
110
110
|
## Navigate To
|
|
111
111
|
|
|
112
|
-
- [APIs](./src/docs/api/api.md) - A complete collection list of available APIs of ***JSU
|
|
112
|
+
- [APIs](./src/docs/api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
package/global.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./src/utils/arithmetic/arithmetic.js";
|
|
1
2
|
import "./src/utils/custom/custom.js";
|
|
2
3
|
import "./src/utils/custom/error/error.js";
|
|
3
4
|
import "./src/utils/dom/dom.js";
|
|
@@ -5,4 +6,3 @@ import "./src/utils/guards/guards.js";
|
|
|
5
6
|
import "./src/utils/primitives/primitives.js";
|
|
6
7
|
import "./src/utils/storage/storage.js";
|
|
7
8
|
import "./src/utils/variables.js";
|
|
8
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carlsebastian/jsu",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A ready-to-use JavaScripts custom utilities such as types validations, formats validations, formatter, and many more!",
|
|
5
5
|
"main": "./global.js",
|
|
6
6
|
"types": "./src/types/global.d.ts",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"require": "./global.js",
|
|
14
14
|
"types": "./src/types/global.d.ts"
|
|
15
15
|
},
|
|
16
|
+
"./arithmetics": {
|
|
17
|
+
"require": "./src/utils/arithmetic/arithmetic.js",
|
|
18
|
+
"types": "./src/types/arithmetic/arithmetic.d.ts"
|
|
19
|
+
},
|
|
16
20
|
"./custom": {
|
|
17
21
|
"require": "./src/utils/custom/custom.js",
|
|
18
22
|
"types": "./src/types/custom/custom.d.ts"
|
|
@@ -49,7 +53,11 @@
|
|
|
49
53
|
"url": "https://github.com/Sebastian-Carl/JSU/issues"
|
|
50
54
|
},
|
|
51
55
|
"homepage": "https://github.com/Sebastian-Carl/JSU#readme",
|
|
52
|
-
"keywords": [
|
|
56
|
+
"keywords": [
|
|
57
|
+
"utils",
|
|
58
|
+
"js-utils",
|
|
59
|
+
"jsu"
|
|
60
|
+
],
|
|
53
61
|
"author": "",
|
|
54
62
|
"license": "ISC"
|
|
55
63
|
}
|
package/src/docs/api/api.md
CHANGED
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
## API List
|
|
16
16
|
|
|
17
|
-
- [Custom API](../custom/custom.md) -
|
|
17
|
+
- [Custom API](../custom/custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
18
|
+
- [ERROR API](../custom/error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
18
19
|
|
|
19
20
|
## Navigate To
|
|
20
21
|
|
|
21
|
-
- [JSU - README](../../../README.MD) - JSU
|
|
22
|
+
- [JSU - README](../../../README.MD) - *JSU Homepage Documentation.*
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
- [Table Of Contents](#table-of-contents)
|
|
7
7
|
- [About](#about)
|
|
8
8
|
- [Usage](#usage)
|
|
9
|
-
- [Properties
|
|
10
|
-
- [Example Usage](#example-usage)
|
|
9
|
+
- [Properties](#properties)
|
|
11
10
|
- [Navigate To](#navigate-to)
|
|
12
11
|
|
|
13
12
|
## About
|
|
@@ -17,42 +16,23 @@
|
|
|
17
16
|
## Usage
|
|
18
17
|
|
|
19
18
|
```js
|
|
20
|
-
|
|
19
|
+
// Loads all available JSU APIs from your project's runtime.
|
|
20
|
+
import "@carlsebastian/jsu";
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
import "@carlsebastian/jsu/custom"; // Loads only Custom API of JSU.
|
|
22
|
+
// Only loads the Custom API of JSU from your project's runtime.
|
|
23
|
+
import "@carlsebastian/jsu/custom";
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
## Properties
|
|
28
|
-
|
|
29
|
-
- [Clamp()](./utils/clamp.md) - Mutates the given numerical value within the given `minimum` and `maximum` range.
|
|
30
|
-
- [ConstructorOrTypeOf()](./utils/constructorOrTypeOf.md) - Retrieves the `constructor` or `type` of the given argument.
|
|
31
|
-
- [Generator()](./utils/generator/generator.md) - A customized generator constructor for generating randomized `tokens`, `characters`, and `integer`.
|
|
32
|
-
- [NameOf()](./utils/nameOf.md) - Retrieves the `name` property of the given object.
|
|
33
|
-
|
|
34
|
-
## Example Usage
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
// #: Ensures that the given numerical value does not exceeds the given range.
|
|
38
|
-
const Pos = 10, minR = 2, maxR = 7;
|
|
39
|
-
console.log(Custom.Clamp(Pos, minR, maxR)); // 7
|
|
40
|
-
|
|
41
|
-
// #: Retrieves the constructor or type of the given argument.
|
|
42
|
-
const Obj = {};
|
|
43
|
-
console.log(Custom.ConstructorOrTypeOf(Obj)); // Object
|
|
26
|
+
## Properties
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// #: Retrieves the name property of the given object.
|
|
50
|
-
const O = { NaME: "o1" };
|
|
51
|
-
console.log(Custom.NameOf(O)); // 'o1'
|
|
52
|
-
```
|
|
28
|
+
- [Clamp()](./utils/clamp.md) - *Mutates the given numerical value within the given **minimum** and **maximum** range.*
|
|
29
|
+
- [ConstructorOrTypeOf()](./utils/constructorOrTypeOf.md) - *Retrieves the **constructor** or **type** of the given argument.*
|
|
30
|
+
- [Generator()](./utils/generator/generator.md) - *A customized generator constructor for generating randomized **tokens**, **characters**, and **integer**.*
|
|
31
|
+
- [NameOf()](./utils/nameOf.md) - *Retrieves the **name** property of the given object.*
|
|
53
32
|
|
|
54
33
|
## Navigate To
|
|
55
34
|
|
|
56
|
-
- [
|
|
35
|
+
- [APIs](../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
36
|
+
- [ERROR](./error/error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
57
37
|
|
|
58
|
-
- [JSU - README](../../../README.MD) - JSU
|
|
38
|
+
- [JSU - README](../../../README.MD) - *JSU Homepage Documentation.*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# JSU - ERROR API - Raise
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Raise](#jsu---error-api---raise)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Properties](#properties)
|
|
9
|
+
- [Navigate To](#navigate-to)
|
|
10
|
+
|
|
11
|
+
## What it does?
|
|
12
|
+
|
|
13
|
+
- It provides a variety of pre-defined collection of static contents meta of every available **Constructors** of **ERROR API** that only requires a few parameters for data to fill in with those contents and throws them through your project's runtime.
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
## Navigate To
|
|
18
|
+
|
|
19
|
+
- [ERROR](../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
20
|
+
- [Raise](../builder/builder.md) - *A collection of customized error class constructors.*
|
|
21
|
+
|
|
22
|
+
- [JSU - README](../../../../../README.MD) - *JSU Homepage Documentation*
|
|
23
|
+
- [APIs](../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
24
|
+
- [Custom](../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors](#jsu---error-api---constructors)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Properties](#properties)
|
|
9
|
+
- [Navigate To](#navigate-to)
|
|
10
|
+
|
|
11
|
+
## What it does?
|
|
12
|
+
|
|
13
|
+
- It provides a variety of customized and/or enhanced collection of error classes.
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
- [ArgumentError()](./opts/argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
18
|
+
- [IndexOutOfBoundsError()](./opts/indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
19
|
+
- [InvalidPropertyError()](./opts/invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
20
|
+
- [MissingParameterError()](./opts/missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
21
|
+
- [MissingPropertyError()](./opts/missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
22
|
+
- [NoSuchElementTagError()](./opts/noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
23
|
+
- [NotSupportedError()](./opts/notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
24
|
+
- [UnknownPropertyError()](./opts/unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
25
|
+
|
|
26
|
+
## Navigate To
|
|
27
|
+
|
|
28
|
+
- [ERROR](../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
29
|
+
- [Raise](../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
30
|
+
|
|
31
|
+
- [JSU - README](../../../../../README.MD) - *JSU Homepage Documentation*
|
|
32
|
+
- [APIs](../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
33
|
+
- [Custom](../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.ArgumentError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.ArgumentError()](#jsu---error-api---constructorsargumenterror)
|
|
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 for any arguments type that violates the expected argument type of certain ***functions*** or ***methods***.
|
|
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.ReceivedArgument` - The reported received argument value that triggered this error.
|
|
27
|
+
- `meta.Args.ExpectedArguments` - A list of expected arguments to receive from an argument.
|
|
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` - The date & time of when this error has occurred.
|
|
37
|
+
|
|
38
|
+
## Example Usage
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
// #: Check and raise an argument error when data is not-a-string type.
|
|
42
|
+
const data = 1;
|
|
43
|
+
const IsStr = typeof data === "string";
|
|
44
|
+
|
|
45
|
+
if (!IsStr)
|
|
46
|
+
throw new ERROR.Constructors.ArgumentError({
|
|
47
|
+
Message: "Received a non-string data!",
|
|
48
|
+
Context: {
|
|
49
|
+
Message: "constant 'data' is a non-string data!",
|
|
50
|
+
Emitter: "foo"
|
|
51
|
+
},
|
|
52
|
+
Args: {
|
|
53
|
+
Id: "data",
|
|
54
|
+
ReceivedArgument: data,
|
|
55
|
+
ExpectedArguments: ["String"]
|
|
56
|
+
},
|
|
57
|
+
Guide: "Ensure to provide a string value from constant 'data'!"
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// [Terminal]: Uncaught ArgumentError ...
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Navigate To
|
|
64
|
+
|
|
65
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
66
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
67
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
68
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
69
|
+
- [MissingParameterError()](./missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
70
|
+
- [MissingPropertyError()](./missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
71
|
+
- [NoSuchElementTagError()](./noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
72
|
+
- [NotSupportedError()](./notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
73
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
74
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
75
|
+
|
|
76
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
77
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
78
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.IndexOutOfBoundsError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.IndexOutOfBoundsError()](#jsu---error-api---constructorsindexoutofboundserror)
|
|
6
|
+
- [Table Of Contents](#table-of-contents)
|
|
7
|
+
- [What it does?](#what-it-does)
|
|
8
|
+
- [Parameters](#parameters)
|
|
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 from an index that exceeded the maximum index-bound of an object list.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
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.Index` - The index the falls or exceeds the maximum-bound of the object list.
|
|
27
|
+
- `meta.Args.MaxBound` - The maximum-bound of index can be at object list.
|
|
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` - The date & time of when this error has occurred.
|
|
37
|
+
|
|
38
|
+
## Example Usage
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
const Pos = 5;
|
|
42
|
+
const Nums = [1, 2, 3, 4, 5];
|
|
43
|
+
|
|
44
|
+
if (Pos > (Nums.length - 1))
|
|
45
|
+
throw new ERROR.Constructors.IndexOutOfBounds({
|
|
46
|
+
Message: "A out-of-bounds index is found!",
|
|
47
|
+
Context: {
|
|
48
|
+
Message: `Index '${Pos}' has exceeded the maximum bound of Nums[]`,
|
|
49
|
+
Emitter: "foo"
|
|
50
|
+
},
|
|
51
|
+
Args: {
|
|
52
|
+
Id: "Pos",
|
|
53
|
+
Index: Pos,
|
|
54
|
+
MaxBound: (Nums.length - 1)
|
|
55
|
+
},
|
|
56
|
+
Guide: `Ensure to provide a index that is within the maximum bound of an object list.`
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// #: Uncaught IndexOutOfBoundsError: ...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Navigate To
|
|
63
|
+
|
|
64
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
65
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
66
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
67
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
68
|
+
- [MissingParameterError()](./missingParameterError.md) - *A custom error class for parameters that does not provided a data.*
|
|
69
|
+
- [MissingPropertyError()](./missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
70
|
+
- [NoSuchElementTagError()](./noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
71
|
+
- [NotSupportedError()](./notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
72
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
73
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
74
|
+
|
|
75
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
76
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
77
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.InvalidPropertyError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.InvalidPropertyError()](#jsu---error-api---constructorsinvalidpropertyerror)
|
|
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 upon a certain object that contains a invalid property (key-pair) data at certain object found. This is useful for strict object structure.
|
|
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 invalid property that has been found at argument id.`
|
|
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
|
+
Greet() => { ... },
|
|
46
|
+
T() => { ... }
|
|
47
|
+
}
|
|
48
|
+
const UserProps = ["Id", "Name", "Address", "Age", "Greed"];
|
|
49
|
+
for (const prop of Object.keys(User)) {
|
|
50
|
+
if (!UserProps.includes(prop))
|
|
51
|
+
throw new ERROR.Constructors.InvalidPropertyError({
|
|
52
|
+
Message: "A invalid property is found at user object!",
|
|
53
|
+
Context: {
|
|
54
|
+
Message: `User.${prop}: Property is unknown or not part of user's object properties.`
|
|
55
|
+
Emitter: "foo"
|
|
56
|
+
},
|
|
57
|
+
Args: {
|
|
58
|
+
Id: "User",
|
|
59
|
+
PropertyId: prop
|
|
60
|
+
},
|
|
61
|
+
Guide: "Ensure to not provide or include a unknown property from 'User' object!"
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// #: Uncaught InvalidPropertyError: ...
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Navigate To
|
|
69
|
+
|
|
70
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
71
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
72
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
73
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
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
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
79
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
80
|
+
|
|
81
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
82
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
83
|
+
- [Custom](../../../custom.md) - *An API that provides a collection of customized and/or enhanced utilities or objects.*
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# JSU - ERROR API - Constructors.MissingParameterError()
|
|
2
|
+
|
|
3
|
+
## Table Of Contents
|
|
4
|
+
|
|
5
|
+
- [JSU - ERROR API - Constructors.MissingParameterError()](#jsu---error-api---constructorsmissingparametererror)
|
|
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 parameter data from a certain **_function_** or **_method_**.
|
|
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.Value` - The current state value of missing parameter.
|
|
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 DoSomething(arg) {
|
|
41
|
+
if (arg === null || arg === undefined)
|
|
42
|
+
throw new ERROR.Constructors.MissingParameterError({
|
|
43
|
+
Message: `A missing parameter is found at DoSomething()!`,
|
|
44
|
+
Context: {
|
|
45
|
+
Message: `DoSomething(arg: ${arg}): Expects argument to be provided!`,
|
|
46
|
+
Emitter: "DoSomething"
|
|
47
|
+
},
|
|
48
|
+
Args: {
|
|
49
|
+
Id: "arg",
|
|
50
|
+
Value: arg
|
|
51
|
+
},
|
|
52
|
+
Guide: "Ensure to provide the parameter argument DoSomething()!"
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return arg++;
|
|
56
|
+
}
|
|
57
|
+
DoSomething(); // #: Uncaught MissingParameterError: ...
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Navigate To
|
|
61
|
+
|
|
62
|
+
- [Error](../../error.md) - *An API that provides a collection of customized and/or enhanced error classes.*
|
|
63
|
+
- [Constructors](../error.constructor.md) - *A collection of customized error class constructors.*
|
|
64
|
+
- [ArgumentError()](./argumentError.md) - *A custom version of Javascript's **TypeError** for invalid arguments types.*
|
|
65
|
+
- [IndexOutOfBoundsError()](./indexOutOfBounds.md) - *A custom version of Javascript's **RangeError** for index that exceeded the maximum index-bound of an object.*
|
|
66
|
+
- [InvalidPropertyError()](./invalidPropertyError.md) - *A custom error class for objects with invalid property.*
|
|
67
|
+
- [MissingPropertyError()](./missingPropertyError.md) - *A custom error class for incomplete or missing key-pair data of an object.*
|
|
68
|
+
- [NoSuchElementTagError()](./noSuchElementTagError.md) - *A custom error class for unknown or not qualified **HTMLElement**, **MathMLElement**, **SVGElement** tags.*
|
|
69
|
+
- [NotSupportedError()](./notSupportedError.md) - *A custom error class for not supported **objects**, **methods**, and/or **functions**.*
|
|
70
|
+
- [UnknownPropertyError()](./unknownPropertyError.md) - *A custom error class for unknown property that is trying to be access from an object.*
|
|
71
|
+
- [Raise](../../builder/builder.md) - *A collection of pre-defined contents builder and raiser of errors.*
|
|
72
|
+
|
|
73
|
+
- [JSU - README](../../../../../../README.MD) - *JSU Homepage Documentation.*
|
|
74
|
+
- [APIs](../../../../api/api.md) - *A complete collection list of available APIs of ***JSU***.*
|
|
75
|
+
- [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.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.*
|