@futdevpro/fsm-dynamo 1.14.10 → 1.14.12
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/.vscode/settings.json +11 -0
- package/build/_collections/constants/data-sizes.const.d.ts +3 -3
- package/build/_collections/constants/data-sizes.const.d.ts.map +1 -1
- package/build/_collections/constants/data-sizes.const.js +4 -3
- package/build/_collections/constants/data-sizes.const.js.map +1 -1
- package/build/_collections/utils/array.util.d.ts +189 -0
- package/build/_collections/utils/array.util.d.ts.map +1 -1
- package/build/_collections/utils/array.util.js +189 -0
- package/build/_collections/utils/array.util.js.map +1 -1
- package/build/_collections/utils/async.util.d.ts +29 -0
- package/build/_collections/utils/async.util.d.ts.map +1 -1
- package/build/_collections/utils/async.util.js +45 -3
- package/build/_collections/utils/async.util.js.map +1 -1
- package/build/_collections/utils/json-error-helper.util.d.ts +38 -0
- package/build/_collections/utils/json-error-helper.util.d.ts.map +1 -1
- package/build/_collections/utils/json-error-helper.util.js +38 -0
- package/build/_collections/utils/json-error-helper.util.js.map +1 -1
- package/build/_collections/utils/log.util.d.ts +195 -5
- package/build/_collections/utils/log.util.d.ts.map +1 -1
- package/build/_collections/utils/log.util.js +245 -53
- package/build/_collections/utils/log.util.js.map +1 -1
- package/build/_collections/utils/math/box-bounds.util.d.ts +36 -0
- package/build/_collections/utils/math/box-bounds.util.d.ts.map +1 -1
- package/build/_collections/utils/math/box-bounds.util.js +38 -6
- package/build/_collections/utils/math/box-bounds.util.js.map +1 -1
- package/build/_collections/utils/math/math.util.d.ts +48 -12
- package/build/_collections/utils/math/math.util.d.ts.map +1 -1
- package/build/_collections/utils/math/math.util.js +51 -15
- package/build/_collections/utils/math/math.util.js.map +1 -1
- package/build/_collections/utils/math/math.util.spec.js +0 -9
- package/build/_collections/utils/math/math.util.spec.js.map +1 -1
- package/build/_collections/utils/math/random.util.d.ts +30 -0
- package/build/_collections/utils/math/random.util.d.ts.map +1 -1
- package/build/_collections/utils/math/random.util.js +30 -0
- package/build/_collections/utils/math/random.util.js.map +1 -1
- package/build/_collections/utils/math/trigonometry.util.d.ts +30 -0
- package/build/_collections/utils/math/trigonometry.util.d.ts.map +1 -1
- package/build/_collections/utils/math/trigonometry.util.js +30 -0
- package/build/_collections/utils/math/trigonometry.util.js.map +1 -1
- package/build/_collections/utils/math/vector2.util.d.ts +247 -17
- package/build/_collections/utils/math/vector2.util.d.ts.map +1 -1
- package/build/_collections/utils/math/vector2.util.js +309 -79
- package/build/_collections/utils/math/vector2.util.js.map +1 -1
- package/build/_collections/utils/object.util.js +9 -7
- package/build/_collections/utils/object.util.js.map +1 -1
- package/build/_collections/utils/regex/password-regex.util.d.ts +12 -0
- package/build/_collections/utils/regex/password-regex.util.d.ts.map +1 -1
- package/build/_collections/utils/regex/password-regex.util.js +12 -0
- package/build/_collections/utils/regex/password-regex.util.js.map +1 -1
- package/build/_collections/utils/round-list.util.d.ts +39 -0
- package/build/_collections/utils/round-list.util.d.ts.map +1 -1
- package/build/_collections/utils/round-list.util.js +39 -0
- package/build/_collections/utils/round-list.util.js.map +1 -1
- package/build/_collections/utils/stack.util.d.ts +19 -0
- package/build/_collections/utils/stack.util.d.ts.map +1 -1
- package/build/_collections/utils/stack.util.js +22 -2
- package/build/_collections/utils/stack.util.js.map +1 -1
- package/build/_collections/utils/stack.util.spec.js +0 -13
- package/build/_collections/utils/stack.util.spec.js.map +1 -1
- package/build/_collections/utils/string.util.d.ts +17 -0
- package/build/_collections/utils/string.util.d.ts.map +1 -1
- package/build/_collections/utils/string.util.js +17 -0
- package/build/_collections/utils/string.util.js.map +1 -1
- package/build/_collections/utils/time.util.d.ts +136 -0
- package/build/_collections/utils/time.util.d.ts.map +1 -1
- package/build/_collections/utils/time.util.js +164 -28
- package/build/_collections/utils/time.util.js.map +1 -1
- package/build/_collections/utils/utilities.util.d.ts +17 -1
- package/build/_collections/utils/utilities.util.d.ts.map +1 -1
- package/build/_collections/utils/utilities.util.js +17 -1
- package/build/_collections/utils/utilities.util.js.map +1 -1
- package/build/_collections/utils/uuid.util.d.ts +6 -0
- package/build/_collections/utils/uuid.util.d.ts.map +1 -1
- package/build/_collections/utils/uuid.util.js +6 -0
- package/build/_collections/utils/uuid.util.js.map +1 -1
- package/build/_enums/data-model-type.enum.d.ts +6 -0
- package/build/_enums/data-model-type.enum.d.ts.map +1 -1
- package/build/_enums/data-model-type.enum.js +6 -0
- package/build/_enums/data-model-type.enum.js.map +1 -1
- package/build/_enums/http/http-call-type.enum.d.ts +8 -0
- package/build/_enums/http/http-call-type.enum.d.ts.map +1 -1
- package/build/_enums/http/http-call-type.enum.js +8 -0
- package/build/_enums/http/http-call-type.enum.js.map +1 -1
- package/build/_enums/http/http-event-type.enum.d.ts +5 -0
- package/build/_enums/http/http-event-type.enum.d.ts.map +1 -1
- package/build/_enums/http/http-event-type.enum.js +5 -0
- package/build/_enums/http/http-event-type.enum.js.map +1 -1
- package/build/_enums/time/day-of-week.enum.d.ts +14 -1
- package/build/_enums/time/day-of-week.enum.d.ts.map +1 -1
- package/build/_enums/time/day-of-week.enum.js +14 -1
- package/build/_enums/time/day-of-week.enum.js.map +1 -1
- package/build/_models/control-models/data-model-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/data-model-params.control-model.js +11 -22
- package/build/_models/control-models/data-model-params.control-model.js.map +1 -1
- package/build/_models/control-models/data-property-params.control-model.d.ts +8 -0
- package/build/_models/control-models/data-property-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/data-property-params.control-model.js +11 -59
- package/build/_models/control-models/data-property-params.control-model.js.map +1 -1
- package/build/_models/control-models/error.control-model.js +8 -25
- package/build/_models/control-models/error.control-model.js.map +1 -1
- package/build/_models/control-models/http/http-error-response.control-model.d.ts +25 -0
- package/build/_models/control-models/http/http-error-response.control-model.d.ts.map +1 -1
- package/build/_models/control-models/http/http-error-response.control-model.js +30 -7
- package/build/_models/control-models/http/http-error-response.control-model.js.map +1 -1
- package/build/_models/control-models/http/http-headers.control-model.d.ts +8 -0
- package/build/_models/control-models/http/http-headers.control-model.d.ts.map +1 -1
- package/build/_models/control-models/http/http-headers.control-model.js +12 -17
- package/build/_models/control-models/http/http-headers.control-model.js.map +1 -1
- package/build/_models/control-models/http/http-response.model-base.d.ts +9 -0
- package/build/_models/control-models/http/http-response.model-base.d.ts.map +1 -1
- package/build/_models/control-models/http/http-response.model-base.js +23 -26
- package/build/_models/control-models/http/http-response.model-base.js.map +1 -1
- package/build/_models/control-models/poll.control-model.d.ts +18 -0
- package/build/_models/control-models/poll.control-model.d.ts.map +1 -1
- package/build/_models/control-models/poll.control-model.js +22 -26
- package/build/_models/control-models/poll.control-model.js.map +1 -1
- package/build/_models/control-models/range-value.control-model.d.ts +141 -0
- package/build/_models/control-models/range-value.control-model.d.ts.map +1 -1
- package/build/_models/control-models/range-value.control-model.js +143 -4
- package/build/_models/control-models/range-value.control-model.js.map +1 -1
- package/build/_models/control-models/server-status.control-model.d.ts +10 -0
- package/build/_models/control-models/server-status.control-model.d.ts.map +1 -1
- package/build/_models/control-models/server-status.control-model.js +10 -12
- package/build/_models/control-models/server-status.control-model.js.map +1 -1
- package/build/_models/control-models/service-endpoint-settings-base.control-model.d.ts +34 -1
- package/build/_models/control-models/service-endpoint-settings-base.control-model.d.ts.map +1 -1
- package/build/_models/control-models/service-endpoint-settings-base.control-model.js +26 -5
- package/build/_models/control-models/service-endpoint-settings-base.control-model.js.map +1 -1
- package/build/_models/data-models/errors.data-model.d.ts +10 -0
- package/build/_models/data-models/errors.data-model.d.ts.map +1 -1
- package/build/_models/data-models/errors.data-model.js +13 -18
- package/build/_models/data-models/errors.data-model.js.map +1 -1
- package/build/_models/data-models/metadata.data-model.d.ts +26 -0
- package/build/_models/data-models/metadata.data-model.d.ts.map +1 -1
- package/build/_models/data-models/metadata.data-model.js +26 -12
- package/build/_models/data-models/metadata.data-model.js.map +1 -1
- package/build/_modules/ai/_models/ai-call-settings.interface.js +46 -49
- package/build/_modules/ai/_models/ai-call-settings.interface.js.map +1 -1
- package/build/_modules/ai/_models/ai-settings.interface.js +0 -3
- package/build/_modules/ai/_models/ai-settings.interface.js.map +1 -1
- package/build/_modules/ai/_modules/anthropic/_models/aai-call-settings.control-model.js +2 -2
- package/build/_modules/ai/_modules/anthropic/_models/aai-call-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/anthropic/_models/aai-settings.control-model.js +3 -3
- package/build/_modules/ai/_modules/anthropic/_models/aai-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/google-ai/_models/gai-call-settings.control-model.js +2 -2
- package/build/_modules/ai/_modules/google-ai/_models/gai-call-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/google-ai/_models/gai-settings.control-model.js +3 -3
- package/build/_modules/ai/_modules/google-ai/_models/gai-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/local-ai/_models/lai-call-settings.control-model.js +1 -1
- package/build/_modules/ai/_modules/local-ai/_models/lai-call-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/local-ai/_models/lai-settings.control-model.js +3 -3
- package/build/_modules/ai/_modules/local-ai/_models/lai-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_models/oai-call-settings.control-model.js +2 -2
- package/build/_modules/ai/_modules/open-ai/_models/oai-call-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_models/oai-settings.control-model.js +3 -3
- package/build/_modules/ai/_modules/open-ai/_models/oai-settings.control-model.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.js +7 -7
- package/build/_modules/ai/_modules/open-ai/index.js.map +1 -1
- package/build/_modules/ci-tools/_models/cit-ci-result-info.data-models.d.ts +23 -0
- package/build/_modules/ci-tools/_models/cit-ci-result-info.data-models.d.ts.map +1 -1
- package/build/_modules/ci-tools/_models/cit-ci-result-info.data-models.js +24 -12
- package/build/_modules/ci-tools/_models/cit-ci-result-info.data-models.js.map +1 -1
- package/build/_modules/crypto/_collections/crypto-2-non-stable.util.js +2 -2
- package/build/_modules/crypto/_collections/crypto-2-non-stable.util.js.map +1 -1
- package/build/_modules/crypto/_collections/crypto-old.util.d.ts.map +1 -1
- package/build/_modules/crypto/_collections/crypto-old.util.js +16 -16
- package/build/_modules/crypto/_collections/crypto-old.util.js.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.js +9 -9
- package/build/_modules/crypto/_collections/crypto.util.js.map +1 -1
- package/build/_modules/custom-data/_models/cud.data-model.d.ts +7 -0
- package/build/_modules/custom-data/_models/cud.data-model.d.ts.map +1 -1
- package/build/_modules/custom-data/_models/cud.data-model.js +7 -1
- package/build/_modules/custom-data/_models/cud.data-model.js.map +1 -1
- package/build/_modules/data-handler/_models/data-handler-settings.control-model.d.ts +73 -0
- package/build/_modules/data-handler/_models/data-handler-settings.control-model.d.ts.map +1 -0
- package/build/_modules/data-handler/_models/data-handler-settings.control-model.js +41 -0
- package/build/_modules/data-handler/_models/data-handler-settings.control-model.js.map +1 -0
- package/build/_modules/data-handler/_models/data-handler.control-model.d.ts +136 -0
- package/build/_modules/data-handler/_models/data-handler.control-model.d.ts.map +1 -0
- package/build/_modules/data-handler/_models/data-handler.control-model.js +293 -0
- package/build/_modules/data-handler/_models/data-handler.control-model.js.map +1 -0
- package/build/_modules/data-handler/_models/data-list-handler.control-model.d.ts +111 -0
- package/build/_modules/data-handler/_models/data-list-handler.control-model.d.ts.map +1 -0
- package/build/_modules/data-handler/_models/data-list-handler.control-model.js +197 -0
- package/build/_modules/data-handler/_models/data-list-handler.control-model.js.map +1 -0
- package/build/_modules/data-handler/_models/data-search-handler.control-model.d.ts +172 -0
- package/build/_modules/data-handler/_models/data-search-handler.control-model.d.ts.map +1 -0
- package/build/_modules/data-handler/_models/data-search-handler.control-model.js +319 -0
- package/build/_modules/data-handler/_models/data-search-handler.control-model.js.map +1 -0
- package/build/_modules/data-handler/_models/list-collector-data-handler.control-model.d.ts +116 -0
- package/build/_modules/data-handler/_models/list-collector-data-handler.control-model.d.ts.map +1 -0
- package/build/_modules/data-handler/_models/list-collector-data-handler.control-model.js +220 -0
- package/build/_modules/data-handler/_models/list-collector-data-handler.control-model.js.map +1 -0
- package/build/_modules/data-handler/index.d.ts +6 -0
- package/build/_modules/data-handler/index.d.ts.map +1 -0
- package/build/_modules/data-handler/index.js +10 -0
- package/build/_modules/data-handler/index.js.map +1 -0
- package/build/_modules/location/_collections/loc-regions.util.d.ts +33 -0
- package/build/_modules/location/_collections/loc-regions.util.d.ts.map +1 -1
- package/build/_modules/location/_collections/loc-regions.util.js +37 -4
- package/build/_modules/location/_collections/loc-regions.util.js.map +1 -1
- package/build/_modules/location/_collections/loc.util.d.ts +10 -0
- package/build/_modules/location/_collections/loc.util.d.ts.map +1 -1
- package/build/_modules/location/_collections/loc.util.js +10 -0
- package/build/_modules/location/_collections/loc.util.js.map +1 -1
- package/build/_modules/messaging/_models/msg-conversation.data-model.js +0 -23
- package/build/_modules/messaging/_models/msg-conversation.data-model.js.map +1 -1
- package/build/_modules/messaging/_models/msg-message.data-model.js +0 -34
- package/build/_modules/messaging/_models/msg-message.data-model.js.map +1 -1
- package/build/_modules/socket/_models/sck-client-params.control-model.js +2 -7
- package/build/_modules/socket/_models/sck-client-params.control-model.js.map +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.js +0 -8
- package/build/_modules/socket/_models/sck-socket-event.control-model.js.map +1 -1
- package/build/_modules/socket/_services/sck-client.service-base.js +69 -72
- package/build/_modules/socket/_services/sck-client.service-base.js.map +1 -1
- package/build/_modules/usage/_models/usg-action.control-model.js +0 -4
- package/build/_modules/usage/_models/usg-action.control-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.js +10 -12
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-data.control-model.js +2 -8
- package/build/_modules/usage/_models/usg-data.control-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-session.data-model.js +2 -18
- package/build/_modules/usage/_models/usg-session.data-model.js.map +1 -1
- package/eslint.config.js +4 -0
- package/futdevpro-fsm-dynamo-01.14.12.tgz +0 -0
- package/package.json +22 -3
- package/src/_collections/constants/data-sizes.const.ts +4 -4
- package/src/_collections/utils/array.util.ts +189 -0
- package/src/_collections/utils/async.util.ts +40 -0
- package/src/_collections/utils/json-error-helper.util.ts +43 -3
- package/src/_collections/utils/log.util.ts +194 -4
- package/src/_collections/utils/math/box-bounds.util.ts +36 -0
- package/src/_collections/utils/math/math.util.spec.ts +0 -10
- package/src/_collections/utils/math/math.util.ts +48 -16
- package/src/_collections/utils/math/random.util.ts +30 -0
- package/src/_collections/utils/math/trigonometry.util.ts +30 -0
- package/src/_collections/utils/math/vector2.util.ts +254 -24
- package/src/_collections/utils/regex/password-regex.util.ts +12 -0
- package/src/_collections/utils/round-list.util.ts +39 -0
- package/src/_collections/utils/stack.util.ts +27 -4
- package/src/_collections/utils/string.util.ts +17 -0
- package/src/_collections/utils/time.util.ts +136 -0
- package/src/_collections/utils/utilities.util.ts +17 -1
- package/src/_collections/utils/uuid.util.ts +6 -0
- package/src/_enums/data-model-type.enum.ts +6 -0
- package/src/_enums/http/http-call-type.enum.ts +8 -0
- package/src/_enums/http/http-event-type.enum.ts +5 -0
- package/src/_enums/time/day-of-week.enum.ts +14 -1
- package/src/_models/control-models/data-model-params.control-model.ts +11 -1
- package/src/_models/control-models/data-property-params.control-model.ts +8 -0
- package/src/_models/control-models/http/http-error-response.control-model.ts +25 -0
- package/src/_models/control-models/http/http-headers.control-model.ts +8 -0
- package/src/_models/control-models/http/http-response.model-base.ts +9 -0
- package/src/_models/control-models/poll.control-model.ts +18 -0
- package/src/_models/control-models/range-value.control-model.ts +141 -0
- package/src/_models/control-models/server-status.control-model.ts +10 -0
- package/src/_models/control-models/service-endpoint-settings-base.control-model.ts +53 -4
- package/src/_models/data-models/errors.data-model.ts +10 -0
- package/src/_models/data-models/metadata.data-model.ts +27 -0
- package/src/_modules/ai/_modules/open-ai/index.ts +4 -3
- package/src/_modules/ci-tools/_models/cit-ci-result-info.data-models.ts +23 -0
- package/src/_modules/crypto/_collections/crypto-old.util.ts +17 -9
- package/src/_modules/custom-data/_models/cud.data-model.ts +7 -0
- package/src/_modules/data-handler/_models/data-handler-settings.control-model.ts +110 -0
- package/src/_modules/data-handler/_models/data-handler.control-model.ts +459 -0
- package/src/_modules/data-handler/_models/data-list-handler.control-model.ts +245 -0
- package/src/_modules/data-handler/_models/data-search-handler.control-model.ts +390 -0
- package/src/_modules/data-handler/_models/list-collector-data-handler.control-model.ts +274 -0
- package/src/_modules/data-handler/index.ts +6 -0
- package/src/_modules/location/_collections/loc-regions.util.ts +34 -1
- package/src/_modules/location/_collections/loc.util.ts +10 -0
- package/src/_modules/usage/_collections/usg-module-settings.const.ts +1 -1
- package/tsconfig.json +2 -2
- package/.eslintrc.json +0 -155
- package/futdevpro-fsm-dynamo-01.14.10.tgz +0 -0
|
@@ -11,6 +11,12 @@ export class DyFM_Trigonometry {
|
|
|
11
11
|
* @param c átfogó
|
|
12
12
|
* @param angle a befogó oldallal szemközti szög (fokban)
|
|
13
13
|
* @returns befogó
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const clamp = DyFM_Trigonometry.getClamp(10, 30);
|
|
18
|
+
* console.log(clamp); // 5
|
|
19
|
+
* ```
|
|
14
20
|
*/
|
|
15
21
|
static getClamp(c: number, angle?: number): number {
|
|
16
22
|
angle = angle !== undefined ? angle : 45;
|
|
@@ -24,6 +30,12 @@ export class DyFM_Trigonometry {
|
|
|
24
30
|
* @param a befogó
|
|
25
31
|
* @param c átfogó
|
|
26
32
|
* @returns befogó
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const clamp = DyFM_Trigonometry.getClampByClampAndHypotenuse(6, 10);
|
|
37
|
+
* console.log(clamp); // 8
|
|
38
|
+
* ```
|
|
27
39
|
*/
|
|
28
40
|
static getClampByClampAndHypotenuse(a: number, c: number): number {
|
|
29
41
|
if (a > c) {
|
|
@@ -45,6 +57,12 @@ export class DyFM_Trigonometry {
|
|
|
45
57
|
* @param a egyik befogó
|
|
46
58
|
* @param b másik befogó
|
|
47
59
|
* @returns átfogó
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const hypotenuse = DyFM_Trigonometry.getHypotenuse(3, 4);
|
|
64
|
+
* console.log(hypotenuse); // 5
|
|
65
|
+
* ```
|
|
48
66
|
*/
|
|
49
67
|
static getHypotenuse(a: number, b?: number): number {
|
|
50
68
|
b = b !== undefined ? b : a;
|
|
@@ -56,6 +74,12 @@ export class DyFM_Trigonometry {
|
|
|
56
74
|
* Szög fokmértéket átalakítja radiánsra
|
|
57
75
|
* @param angle szög fok
|
|
58
76
|
* @returns szög radiáns
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const radians = DyFM_Trigonometry.angleToRadians(180);
|
|
81
|
+
* console.log(radians); // 3.141592653589793
|
|
82
|
+
* ```
|
|
59
83
|
*/
|
|
60
84
|
static angleToRadians(angle: number): number {
|
|
61
85
|
return angle * Math.PI / 180;
|
|
@@ -65,6 +89,12 @@ export class DyFM_Trigonometry {
|
|
|
65
89
|
* Szög radiáns mértéket átalakítja fokra
|
|
66
90
|
* @param radians szög radiáns
|
|
67
91
|
* @returns szög fok
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const angle = DyFM_Trigonometry.radiansToAngle(3.141592653589793);
|
|
96
|
+
* console.log(angle); // 180
|
|
97
|
+
* ```
|
|
68
98
|
*/
|
|
69
99
|
static radiansToAngle(radians: number): number {
|
|
70
100
|
return radians / Math.PI * 180;
|
|
@@ -12,6 +12,13 @@ export type DyFM_Vector2_U = DyFM_Vector2_Util;
|
|
|
12
12
|
* is that static functions return new Vector2,
|
|
13
13
|
* while instance functions change the current Vector2 and returns itself.
|
|
14
14
|
* (if this is not true, report it as a bug)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const vector2 = new DyFM_Vector2_Util(1);
|
|
19
|
+
* const vector2 = new DyFM_Vector2_Util(1, 2);
|
|
20
|
+
* const vector2 = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
21
|
+
* ```
|
|
15
22
|
*/
|
|
16
23
|
export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
17
24
|
readonly isVector2Util: boolean = true;
|
|
@@ -102,6 +109,12 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
102
109
|
|
|
103
110
|
/**
|
|
104
111
|
* returns the distance between two vectors
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const distance = DyFM_Vector2_Util.distance({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
116
|
+
* console.log(distance); // 2.8284271247461903
|
|
117
|
+
* ```
|
|
105
118
|
*/
|
|
106
119
|
static distance(a: DyFM_Vector2, b: DyFM_Vector2): number {
|
|
107
120
|
return this.minus(a, b).magintude;
|
|
@@ -111,7 +124,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
/**
|
|
114
|
-
* returns a new vector with the
|
|
127
|
+
* returns a new vector with the subtraction of two vectors
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const minus = DyFM_Vector2_Util.minus({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
132
|
+
* console.log(minus); // { x: -2, y: -2 }
|
|
133
|
+
* ```
|
|
115
134
|
*/
|
|
116
135
|
static minus(a: DyFM_Vector2, minusB: DyFM_Vector2): DyFM_Vector2_Util {
|
|
117
136
|
return this.plus(a, this.negative(minusB));
|
|
@@ -124,6 +143,12 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
124
143
|
|
|
125
144
|
/**
|
|
126
145
|
* returns a new vector with the sum of two vectors
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const plus = DyFM_Vector2_Util.plus({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
150
|
+
* console.log(plus); // { x: 4, y: 6 }
|
|
151
|
+
* ```
|
|
127
152
|
*/
|
|
128
153
|
static plus(a: DyFM_Vector2, plusB: DyFM_Vector2): DyFM_Vector2_Util {
|
|
129
154
|
return new DyFM_Vector2_Util(a.x + plusB.x, a.y + plusB.y);
|
|
@@ -136,7 +161,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
136
161
|
static readonly add = this.plus;
|
|
137
162
|
readonly add = this.plus;
|
|
138
163
|
|
|
139
|
-
/** returns new
|
|
164
|
+
/** returns a new vector with the multiplication of two vectors
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const multiply = DyFM_Vector2_Util.multiply({ x: 1, y: 2 }, 2);
|
|
168
|
+
* console.log(multiply); // { x: 2, y: 4 }
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
140
171
|
static multiply(v: DyFM_Vector2, n: number): DyFM_Vector2_Util {
|
|
141
172
|
return new DyFM_Vector2_Util(v.x * n, v.y * n);
|
|
142
173
|
}
|
|
@@ -144,7 +175,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
144
175
|
return this.newValues(DyFM_Vector2_Util.multiply(this, n));
|
|
145
176
|
}
|
|
146
177
|
|
|
147
|
-
/** returns new
|
|
178
|
+
/** returns a new vector with the division of two vectors
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const divide = DyFM_Vector2_Util.divide({ x: 1, y: 2 }, 2);
|
|
182
|
+
* console.log(divide); // { x: 0.5, y: 1 }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
148
185
|
static divide(v: DyFM_Vector2, divideBy: number): DyFM_Vector2_Util {
|
|
149
186
|
return new DyFM_Vector2_Util(v.x / divideBy, v.y / divideBy);
|
|
150
187
|
}
|
|
@@ -154,6 +191,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
154
191
|
return this;
|
|
155
192
|
}
|
|
156
193
|
|
|
194
|
+
/** returns the negative value of the original vector at new vector
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* const negative = DyFM_Vector2_Util.negative({ x: 1, y: 2 });
|
|
198
|
+
* console.log(negative); // { x: -1, y: -2 }
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
157
201
|
static negative(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
158
202
|
return new DyFM_Vector2_Util(-v.x, -v.y);
|
|
159
203
|
}
|
|
@@ -168,7 +212,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
168
212
|
}
|
|
169
213
|
|
|
170
214
|
/**
|
|
171
|
-
* returns a new vector with the
|
|
215
|
+
* returns a new vector with the rebase of the original vector
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```ts
|
|
219
|
+
* const rebase = DyFM_Vector2_Util.rebase({ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 });
|
|
220
|
+
* console.log(rebase); // { x: 4, y: 6 }
|
|
221
|
+
* ```
|
|
172
222
|
*/
|
|
173
223
|
static rebase(v: DyFM_Vector2, baseFrom: DyFM_Vector2, baseTo: DyFM_Vector2): DyFM_Vector2_Util {
|
|
174
224
|
return this.plus(v, this.minus(baseTo, baseFrom));
|
|
@@ -180,15 +230,28 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
180
230
|
}
|
|
181
231
|
|
|
182
232
|
/**
|
|
183
|
-
* returns a new vector with the
|
|
233
|
+
* returns a new vector with the rotation of the original vector by degrees
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* const rotate = DyFM_Vector2_Util.rotate({ x: 1, y: 2 }, 30);
|
|
238
|
+
* console.log(rotate); // { x: 0.8660254037844386, y: 1.5 }
|
|
239
|
+
* ```
|
|
184
240
|
*/
|
|
185
241
|
static rotate(vector: DyFM_Vector2, angle: number): DyFM_Vector2_Util {
|
|
186
242
|
const rad = DyFM_Trigonometry.angleToRadians(angle);
|
|
187
243
|
|
|
188
244
|
return this.rotateRad(vector, rad);
|
|
189
245
|
}
|
|
246
|
+
|
|
190
247
|
/**
|
|
191
|
-
* returns a new vector with the
|
|
248
|
+
* returns a new vector with the rotation of the original vector by radians
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```ts
|
|
252
|
+
* const rotateRad = DyFM_Vector2_Util.rotateRad({ x: 1, y: 2 }, 3.141592653589793);
|
|
253
|
+
* console.log(rotateRad); // { x: -1, y: 2 }
|
|
254
|
+
* ```
|
|
192
255
|
*/
|
|
193
256
|
static rotateRad(vector: DyFM_Vector2, rad: number): DyFM_Vector2_Util {
|
|
194
257
|
const cos = Math.cos(rad);
|
|
@@ -198,16 +261,30 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
198
261
|
|
|
199
262
|
return new DyFM_Vector2_Util(newX, newY);
|
|
200
263
|
}
|
|
264
|
+
|
|
201
265
|
/**
|
|
202
|
-
* returns a new vector with the
|
|
266
|
+
* returns a new vector with the rotation of the original vector by degrees
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
271
|
+
* vector.rotate(30);
|
|
272
|
+
* ```
|
|
203
273
|
*/
|
|
204
274
|
rotate(angle: number): this {
|
|
205
275
|
this.newValues(DyFM_Vector2_Util.rotate(this, angle));
|
|
206
276
|
|
|
207
277
|
return this;
|
|
208
278
|
}
|
|
279
|
+
|
|
209
280
|
/**
|
|
210
|
-
* returns a new vector with the
|
|
281
|
+
* returns a new vector with the rotation of the original vector by radians
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
286
|
+
* vector.rotateRad(3.141592653589793);
|
|
287
|
+
* ```
|
|
211
288
|
*/
|
|
212
289
|
rotateRad(rad: number): this {
|
|
213
290
|
this.newValues(DyFM_Vector2_Util.rotateRad(this, rad));
|
|
@@ -216,15 +293,28 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
216
293
|
}
|
|
217
294
|
|
|
218
295
|
/**
|
|
219
|
-
* returns a new
|
|
296
|
+
* returns a new DyFM_Vector2_Util with the new values
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```ts
|
|
300
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
301
|
+
* vector.newValues({ x: 3, y: 4 });
|
|
302
|
+
* ```
|
|
220
303
|
*/
|
|
221
304
|
newValues(newV: DyFM_Vector2): this {
|
|
222
305
|
this.newXY(newV.x, newV.y);
|
|
223
306
|
|
|
224
307
|
return this;
|
|
225
308
|
}
|
|
309
|
+
|
|
226
310
|
/**
|
|
227
311
|
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
316
|
+
* vector.newXY(3, 4);
|
|
317
|
+
* ```
|
|
228
318
|
*/
|
|
229
319
|
newXY(newX: number, newY: number): this {
|
|
230
320
|
this._x = newX;
|
|
@@ -234,8 +324,15 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
234
324
|
|
|
235
325
|
return this;
|
|
236
326
|
}
|
|
327
|
+
|
|
237
328
|
/**
|
|
238
|
-
* returns a new
|
|
329
|
+
* returns a new DyFM_Vector2_Util with the new values
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
334
|
+
* DyFM_Vector2_Util.newValues(vector, { x: 3, y: 4 });
|
|
335
|
+
* ```
|
|
239
336
|
*/
|
|
240
337
|
static newValues(to: DyFM_Vector2, newV: DyFM_Vector2): DyFM_Vector2 {
|
|
241
338
|
to.x = newV.x;
|
|
@@ -248,36 +345,75 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
248
345
|
//// AI-ed UNCHECKED
|
|
249
346
|
/**
|
|
250
347
|
* returns the angle between two vectors
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* const angle = DyFM_Vector2_Util.angle({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
352
|
+
* console.log(angle); // 45
|
|
353
|
+
* ```
|
|
251
354
|
*/
|
|
252
355
|
static angle(from: DyFM_Vector2, to: DyFM_Vector2): number {
|
|
253
356
|
return DyFM_Trigonometry.radiansToAngle(DyFM_Vector2_Util.angleRad(from, to));
|
|
254
357
|
}
|
|
358
|
+
|
|
255
359
|
/**
|
|
256
360
|
* returns the angle between two vectors in radians
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* const angleRad = DyFM_Vector2_Util.angleRad({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
365
|
+
* console.log(angleRad); // 0.7853981633974483
|
|
366
|
+
* ```
|
|
257
367
|
*/
|
|
258
368
|
static angleRad(from: DyFM_Vector2, to: DyFM_Vector2): number {
|
|
259
369
|
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
260
370
|
}
|
|
371
|
+
|
|
261
372
|
/**
|
|
262
373
|
* returns the angle between two vectors
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```ts
|
|
377
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
378
|
+
* const angle = vector.angle({ x: 3, y: 4 });
|
|
379
|
+
* console.log(angle); // 45
|
|
380
|
+
* ```
|
|
263
381
|
*/
|
|
264
382
|
angle(from: DyFM_Vector2, to: DyFM_Vector2): number {
|
|
265
383
|
return DyFM_Vector2_Util.angle(from, to);
|
|
266
384
|
}
|
|
267
385
|
/**
|
|
268
386
|
* returns the angle between two vectors in degrees
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```ts
|
|
390
|
+
* const angle = DyFM_Vector2_Util.deg({ x: 1, y: 2 });
|
|
391
|
+
* console.log(angle); // 45
|
|
269
392
|
*/
|
|
270
393
|
static deg(vector: DyFM_Vector2): number {
|
|
271
394
|
return DyFM_Trigonometry.radiansToAngle(DyFM_Vector2_Util.rad(vector));
|
|
272
395
|
}
|
|
273
396
|
/**
|
|
274
397
|
* returns the angle between two vectors in radians
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* const angleRad = DyFM_Vector2_Util.rad({ x: 1, y: 2 });
|
|
402
|
+
* console.log(angleRad); // 0.7853981633974483
|
|
403
|
+
* ```
|
|
275
404
|
*/
|
|
276
405
|
static rad(vector: DyFM_Vector2): number {
|
|
277
406
|
return Math.atan2(vector.y, vector.x);
|
|
278
407
|
}
|
|
279
408
|
/**
|
|
280
|
-
* returns the angle
|
|
409
|
+
* returns the vector angle in degrees
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
414
|
+
* const deg = vector.deg();
|
|
415
|
+
* console.log(deg); // 45
|
|
416
|
+
* ```
|
|
281
417
|
*/
|
|
282
418
|
deg(): number {
|
|
283
419
|
return DyFM_Vector2_Util.deg(this);
|
|
@@ -285,12 +421,25 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
285
421
|
|
|
286
422
|
/**
|
|
287
423
|
* returns math floor of the vector
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* const vector = DyFM_Vector2_Util.floor({ x: 1.5, y: 2.5 });
|
|
428
|
+
* console.log(vector); // { x: 1, y: 2 }
|
|
429
|
+
* ```
|
|
288
430
|
*/
|
|
289
431
|
static floor(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
290
432
|
return new DyFM_Vector2_Util(Math.floor(v.x), Math.floor(v.y));
|
|
291
433
|
}
|
|
292
434
|
/**
|
|
293
435
|
* returns math floor of the vector
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```ts
|
|
439
|
+
* const vector = new DyFM_Vector2_Util({ x: 1.5, y: 2.5 });
|
|
440
|
+
* const floor = vector.floor();
|
|
441
|
+
* console.log(floor); // { x: 1, y: 2 }
|
|
442
|
+
* ```
|
|
294
443
|
*/
|
|
295
444
|
floor(): DyFM_Vector2_Util {
|
|
296
445
|
return DyFM_Vector2_Util.floor(this);
|
|
@@ -299,12 +448,25 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
299
448
|
|
|
300
449
|
/**
|
|
301
450
|
* returns the direction vector from one point to another
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```ts
|
|
454
|
+
* const direction = DyFM_Vector2_Util.direction({ x: 1, y: 2 }, { x: 3, y: 4 });
|
|
455
|
+
* console.log(direction); // { x: 2, y: 2 }
|
|
456
|
+
* ```
|
|
302
457
|
*/
|
|
303
458
|
static direction(from: DyFM_Vector2, to: DyFM_Vector2): DyFM_Vector2_Util {
|
|
304
459
|
return DyFM_Vector2_Util.minus(to, from);
|
|
305
460
|
}
|
|
306
461
|
/**
|
|
307
462
|
* returns the direction vector from one point to another
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```ts
|
|
466
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
467
|
+
* const direction = vector.direction({ x: 3, y: 4 });
|
|
468
|
+
* console.log(direction); // { x: 2, y: 2 }
|
|
469
|
+
* ```
|
|
308
470
|
*/
|
|
309
471
|
direction(to: DyFM_Vector2): DyFM_Vector2_Util {
|
|
310
472
|
return DyFM_Vector2_Util.direction(this, to);
|
|
@@ -312,6 +474,12 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
312
474
|
|
|
313
475
|
/**
|
|
314
476
|
* returns a normalized vector
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```ts
|
|
480
|
+
* const vector = DyFM_Vector2_Util.normalize({ x: 1, y: 2 });
|
|
481
|
+
* console.log(vector); // { x: 0.4472135954999579, y: 0.8944271909999159 }
|
|
482
|
+
* ```
|
|
315
483
|
*/
|
|
316
484
|
static normalize(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
317
485
|
const v_U = new DyFM_Vector2_Util(v);
|
|
@@ -320,6 +488,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
320
488
|
}
|
|
321
489
|
/**
|
|
322
490
|
* returns a normalized vector
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```ts
|
|
494
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
495
|
+
* vector.normalize();
|
|
496
|
+
* console.log(vector); // { x: 0.4472135954999579, y: 0.8944271909999159 }
|
|
497
|
+
* ```
|
|
323
498
|
*/
|
|
324
499
|
normalize(): void {
|
|
325
500
|
this.newValues(DyFM_Vector2_Util.normalize(this));
|
|
@@ -327,13 +502,27 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
327
502
|
/**
|
|
328
503
|
* this will return a new instance,
|
|
329
504
|
* if you want to change the current instance, use normalize()
|
|
330
|
-
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```ts
|
|
508
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
509
|
+
* const normalized = vector.normalized();
|
|
510
|
+
* console.log(normalized); // { x: 0.4472135954999579, y: 0.8944271909999159 }
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
331
513
|
normalized(): DyFM_Vector2_Util {
|
|
332
514
|
return DyFM_Vector2_Util.normalize(this);
|
|
333
515
|
}
|
|
334
516
|
|
|
335
517
|
/**
|
|
336
518
|
* returns the magnitude of the vector
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts
|
|
522
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
523
|
+
* const magnitude = vector.magnitude();
|
|
524
|
+
* console.log(magnitude); // 2.23606797749979
|
|
525
|
+
* ```
|
|
337
526
|
*/
|
|
338
527
|
private calcMagnitude(): void {
|
|
339
528
|
this._magintude = DyFM_Trigonometry.getHypotenuse(this._x, this._y);
|
|
@@ -341,6 +530,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
341
530
|
|
|
342
531
|
/**
|
|
343
532
|
* returns a new vector with the same values
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```ts
|
|
536
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
537
|
+
* const clone = vector.clone();
|
|
538
|
+
* console.log(clone); // { x: 1, y: 2 }
|
|
539
|
+
* ```
|
|
344
540
|
*/
|
|
345
541
|
clone(): DyFM_Vector2_Util {
|
|
346
542
|
return new DyFM_Vector2_Util(this._x, this._y);
|
|
@@ -348,6 +544,14 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
348
544
|
|
|
349
545
|
/**
|
|
350
546
|
* returns true if the vector has changed
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```ts
|
|
550
|
+
* const vector1 = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
551
|
+
* const vector2 = new DyFM_Vector2_Util({ x: 3, y: 4 });
|
|
552
|
+
* const isChanged = DyFM_Vector2_Util.isChanged(vector1, vector2);
|
|
553
|
+
* console.log(isChanged); // true
|
|
554
|
+
* ```
|
|
351
555
|
*/
|
|
352
556
|
static isChanged(a: DyFM_Vector2_Util, b: DyFM_Vector2_Util): boolean {
|
|
353
557
|
return a.x !== b.x || a.y !== b.y;
|
|
@@ -355,27 +559,43 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
355
559
|
|
|
356
560
|
/**
|
|
357
561
|
* returns true if the vectors are equal
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* ```ts
|
|
565
|
+
* const vector1 = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
566
|
+
* const vector2 = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
567
|
+
* const isEqual = DyFM_Vector2_Util.isEqual(vector1, vector2);
|
|
568
|
+
* console.log(isEqual); // true
|
|
569
|
+
* ```
|
|
358
570
|
*/
|
|
359
571
|
static isEqual(a: DyFM_Vector2, b: DyFM_Vector2): boolean {
|
|
360
572
|
return a.x === b.x && a.y === b.y;
|
|
361
573
|
}
|
|
362
574
|
|
|
363
575
|
/**
|
|
364
|
-
* returns true if the vectors
|
|
576
|
+
* returns true if the vectors have changed
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* const vector1 = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
581
|
+
* const vector2 = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
582
|
+
* const isVectorChanged = DyFM_Vector2_Util.vectorChanged(vector1, vector2);
|
|
583
|
+
* console.log(isVectorChanged); // false
|
|
584
|
+
* ```
|
|
365
585
|
*/
|
|
366
586
|
static vectorChanged(a: DyFM_Vector2, b: DyFM_Vector2): boolean {
|
|
367
587
|
return a.x !== b.x || a.y !== b.y;
|
|
368
588
|
}
|
|
369
589
|
|
|
370
|
-
/**
|
|
371
|
-
* returns true if the vectors are equal
|
|
372
|
-
*/
|
|
373
|
-
static equals(a: DyFM_Vector2, b: DyFM_Vector2): boolean {
|
|
374
|
-
return a.x === b.x && a.y === b.y;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
590
|
/**
|
|
378
591
|
* returns a new vector with the absolute values of the original vector
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```ts
|
|
595
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
596
|
+
* const vector = DyFM_Vector2_Util.abs(vector);
|
|
597
|
+
* console.log(vector);
|
|
598
|
+
* ```
|
|
379
599
|
*/
|
|
380
600
|
static abs(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
381
601
|
return new DyFM_Vector2_Util(Math.abs(v.x), Math.abs(v.y));
|
|
@@ -386,6 +606,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
386
606
|
|
|
387
607
|
/**
|
|
388
608
|
* returns a new vector with the rounded values of the original vector
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```ts
|
|
612
|
+
* const vector = new DyFM_Vector2_Util({ x: 1.5, y: 2.5 });
|
|
613
|
+
* const rounded = DyFM_Vector2_Util.round(vector);
|
|
614
|
+
* const rounded2 = DyFM_Vector2_Util.round(vector,3);
|
|
615
|
+
* ```
|
|
389
616
|
*/
|
|
390
617
|
static round(v: DyFM_Vector2, decimals: number = 0): DyFM_Vector2_Util {
|
|
391
618
|
return new DyFM_Vector2_Util(
|
|
@@ -396,6 +623,13 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
396
623
|
|
|
397
624
|
/**
|
|
398
625
|
* returns a instance of DyFM_Vector2 from a DyFM_Vector2_Util
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* ```ts
|
|
629
|
+
* const vector = new DyFM_Vector2_Util({ x: 1, y: 2 });
|
|
630
|
+
* const vector2 = DyFM_Vector2_Util.toVector2(vector);
|
|
631
|
+
* console.log(vector2);
|
|
632
|
+
* ```
|
|
399
633
|
*/
|
|
400
634
|
static toVector2(v: DyFM_Vector2_Util): DyFM_Vector2 {
|
|
401
635
|
return (new DyFM_Vector2_Util(v)).get();
|
|
@@ -417,7 +651,3 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
417
651
|
return { x: v.x, y: v.y };
|
|
418
652
|
}
|
|
419
653
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
@@ -11,6 +11,18 @@ export const DyFM_passwordRegex: RegExp = new RegExp(
|
|
|
11
11
|
'Password must include at least one of the !@#$%^&* characters.' +
|
|
12
12
|
'Password must be at least 6 characters long.'; */
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* returns an array of errors for a given password if it not match all the requirements
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const errors = DyFM_getPasswordErrors('Invalid1');
|
|
20
|
+
* console.log(errors); // ['Password must include at least one of the !@#$%^&* characters.']
|
|
21
|
+
*
|
|
22
|
+
* const errors = DyFM_getPasswordErrors('ValidPassword1!');
|
|
23
|
+
* console.log(errors); // []
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
14
26
|
export function DyFM_getPasswordErrors(password: string): string[] {
|
|
15
27
|
const errors: string[] = [];
|
|
16
28
|
|
|
@@ -11,6 +11,14 @@ export class DyFM_RoundList {
|
|
|
11
11
|
* @param listLength
|
|
12
12
|
* @param outboundIndex
|
|
13
13
|
* @returns
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const listLength = 10;
|
|
18
|
+
* const outboundIndex = 15;
|
|
19
|
+
* const result = DyFM_RoundList.getOutboundedIndex(listLength, outboundIndex);
|
|
20
|
+
* console.log(result); // 5
|
|
21
|
+
* ```
|
|
14
22
|
*/
|
|
15
23
|
static getOutboundedIndex(listLength: number, outboundIndex: number): number {
|
|
16
24
|
if (!listLength) {
|
|
@@ -36,6 +44,14 @@ export class DyFM_RoundList {
|
|
|
36
44
|
* @param length
|
|
37
45
|
* @param oppositeOf
|
|
38
46
|
* @returns
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const length = 10;
|
|
51
|
+
* const oppositeOf = 5;
|
|
52
|
+
* const result = DyFM_RoundList.getIndexOpposite(length, oppositeOf);
|
|
53
|
+
* console.log(result); // 0
|
|
54
|
+
* ```
|
|
39
55
|
*/
|
|
40
56
|
static getIndexOpposite(length: number, oppositeOf: number): number {
|
|
41
57
|
const plusIndex = oppositeOf + Math.round(length / 2);
|
|
@@ -49,6 +65,14 @@ export class DyFM_RoundList {
|
|
|
49
65
|
* @param list
|
|
50
66
|
* @param outboundIndex
|
|
51
67
|
* @returns
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const list = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
|
|
72
|
+
* const outboundIndex = 15;
|
|
73
|
+
* const result = DyFM_RoundList.getListIndex(list, outboundIndex);
|
|
74
|
+
* console.log(result); // 5
|
|
75
|
+
* ```
|
|
52
76
|
*/
|
|
53
77
|
static getListIndex<T>(list: T[], outboundIndex: number): T {
|
|
54
78
|
return list[this.getOutboundedIndex(list.length, outboundIndex)];
|
|
@@ -59,6 +83,14 @@ export class DyFM_RoundList {
|
|
|
59
83
|
* @param list
|
|
60
84
|
* @param oppositeOf
|
|
61
85
|
* @returns
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const list = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
|
|
90
|
+
* const oppositeOf = 5;
|
|
91
|
+
* const result = DyFM_RoundList.getListOpposite(list, oppositeOf);
|
|
92
|
+
* console.log(result); // 0
|
|
93
|
+
* ```
|
|
62
94
|
*/
|
|
63
95
|
static getListOpposite<T>(list: T[], oppositeOf: T): T {
|
|
64
96
|
return list[this.getIndexOpposite(list.length, list.indexOf(oppositeOf))];
|
|
@@ -67,6 +99,13 @@ export class DyFM_RoundList {
|
|
|
67
99
|
/**
|
|
68
100
|
* returns the last element of the list
|
|
69
101
|
* returns null if the list is empty
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const list = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
|
|
106
|
+
* const result = DyFM_RoundList.getLast(list);
|
|
107
|
+
* console.log(result); // 10
|
|
108
|
+
* ```
|
|
70
109
|
*/
|
|
71
110
|
static getLast<T>(list: T[]): T | null {
|
|
72
111
|
if (0 < list.length) {
|