@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
|
@@ -7,9 +7,15 @@ const vector2_util_1 = require("./vector2.util");
|
|
|
7
7
|
* is that static functions return new BoxBounds,
|
|
8
8
|
* while instance functions change the current BoxBounds and returns itself.
|
|
9
9
|
* (if this is not true, report it as a bug)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const boxBounds = new DyFM_BoxBounds_Util({ x: 0, y: 0 }, { x: 10, y: 10 });
|
|
14
|
+
* boxBounds.pos = { x: 5, y: 5 };
|
|
15
|
+
* console.log(boxBounds.pos);
|
|
16
|
+
* ```
|
|
10
17
|
*/
|
|
11
18
|
class DyFM_BoxBounds_Util {
|
|
12
|
-
_pos;
|
|
13
19
|
/**
|
|
14
20
|
* setting the position will also recalculate the center and centerMargin
|
|
15
21
|
*/
|
|
@@ -23,7 +29,6 @@ class DyFM_BoxBounds_Util {
|
|
|
23
29
|
get pos() {
|
|
24
30
|
return this._pos;
|
|
25
31
|
}
|
|
26
|
-
_size;
|
|
27
32
|
/**
|
|
28
33
|
* setting the size will also recalculate the center and centerMargin
|
|
29
34
|
*/
|
|
@@ -37,7 +42,6 @@ class DyFM_BoxBounds_Util {
|
|
|
37
42
|
get size() {
|
|
38
43
|
return this._size;
|
|
39
44
|
}
|
|
40
|
-
_center;
|
|
41
45
|
/**
|
|
42
46
|
* getting the center will return the center as a DyFM_Vector2_Util
|
|
43
47
|
* (this is calculated from the position and size every time they are set)
|
|
@@ -45,7 +49,6 @@ class DyFM_BoxBounds_Util {
|
|
|
45
49
|
get center() {
|
|
46
50
|
return this._center;
|
|
47
51
|
}
|
|
48
|
-
_centerMargin;
|
|
49
52
|
/**
|
|
50
53
|
* getting the centerMargin will return the centerMargin as a DyFM_Vector2_Util
|
|
51
54
|
* (this is calculated from the size every time it is set)
|
|
@@ -58,6 +61,8 @@ class DyFM_BoxBounds_Util {
|
|
|
58
61
|
position,
|
|
59
62
|
/** height and width */
|
|
60
63
|
size) {
|
|
64
|
+
this.getBoxBounds = this.get;
|
|
65
|
+
this.toBoxBounds = this.get;
|
|
61
66
|
this._pos = new vector2_util_1.DyFM_Vector2_Util(position);
|
|
62
67
|
this._size = new vector2_util_1.DyFM_Vector2_Util(size);
|
|
63
68
|
this.calcCenter();
|
|
@@ -71,6 +76,12 @@ class DyFM_BoxBounds_Util {
|
|
|
71
76
|
/**
|
|
72
77
|
* sets the position and size of the box bounds
|
|
73
78
|
* (this will also recalculate the center and centerMargin)
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const boxBounds = new DyFM_BoxBounds_Util({ x: 0, y: 0 }, { x: 10, y: 10 });
|
|
83
|
+
* boxBounds.newValues({ x: 5, y: 5 }, { x: 20, y: 20 });
|
|
84
|
+
* ```
|
|
74
85
|
*/
|
|
75
86
|
newValues(position, size) {
|
|
76
87
|
if (position === undefined) {
|
|
@@ -85,6 +96,14 @@ class DyFM_BoxBounds_Util {
|
|
|
85
96
|
}
|
|
86
97
|
/**
|
|
87
98
|
* returns true if the position is within the box bounds
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const boxBounds = new DyFM_BoxBounds_Util({ x: 0, y: 0 }, { x: 10, y: 10 });
|
|
103
|
+
* const position = new DyFM_Vector2({ x: 5, y: 5 });
|
|
104
|
+
* const isWithinBounds = DyFM_BoxBounds_Util.bounds(boxBounds, position);
|
|
105
|
+
* console.log(isWithinBounds);
|
|
106
|
+
* ```
|
|
88
107
|
*/
|
|
89
108
|
static bounds(box, position) {
|
|
90
109
|
return box.pos.x <= position.x && position.x <= box.pos.x + box.size.x &&
|
|
@@ -92,12 +111,21 @@ class DyFM_BoxBounds_Util {
|
|
|
92
111
|
}
|
|
93
112
|
/**
|
|
94
113
|
* returns true if the position is within the box bounds
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const boxBounds = new DyFM_BoxBounds_Util({ x: 0, y: 0 }, { x: 10, y: 10 });
|
|
118
|
+
* const isWithinBounds = boxBounds.bounds(new DyFM_Vector2({ x: 5, y: 5 });
|
|
119
|
+
* console.log(isWithinBounds);
|
|
120
|
+
* ```
|
|
95
121
|
*/
|
|
96
122
|
bounds(position) {
|
|
97
123
|
return DyFM_BoxBounds_Util.bounds(this, position);
|
|
98
124
|
}
|
|
99
125
|
/**
|
|
100
126
|
* calculates the center and centerMargin of the box bounds
|
|
127
|
+
*
|
|
128
|
+
* only usable inside the class
|
|
101
129
|
*/
|
|
102
130
|
calcCenter() {
|
|
103
131
|
const halfSize = vector2_util_1.DyFM_Vector2_Util.divide(this.size, 2);
|
|
@@ -115,10 +143,14 @@ class DyFM_BoxBounds_Util {
|
|
|
115
143
|
centerMargin: this._centerMargin.get()
|
|
116
144
|
};
|
|
117
145
|
}
|
|
118
|
-
getBoxBounds = this.get;
|
|
119
|
-
toBoxBounds = this.get;
|
|
120
146
|
/**
|
|
121
147
|
* returns a new DyFM_BoxBounds_Util with the same position and size
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const boxBounds = new DyFM_BoxBounds_Util({ x: 0, y: 0 }, { x: 10, y: 10 });
|
|
152
|
+
* const clonedBoxBounds = boxBounds.clone();
|
|
153
|
+
* ```
|
|
122
154
|
*/
|
|
123
155
|
clone() {
|
|
124
156
|
return new DyFM_BoxBounds_Util(this._pos.clone(), this._size.clone());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box-bounds.util.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/box-bounds.util.ts"],"names":[],"mappings":";;;AAIA,iDAAmD;AAEnD
|
|
1
|
+
{"version":3,"file":"box-bounds.util.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/box-bounds.util.ts"],"names":[],"mappings":";;;AAIA,iDAAmD;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAa,mBAAmB;IAE9B;;OAEG;IACH,IAAI,GAAG,CAAC,KAAmB;QACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE3B,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IACD;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAGD;;OAEG;IACH,IAAI,IAAI,CAAC,KAAmB;QAC1B,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAE5B,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IACD;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAGD;;;OAGG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAGD;;;OAGG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;IACE,sBAAsB;IACtB,QAAuB;IACvB,uBAAuB;IACvB,IAAmB;QA4FrB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C3B,OAAO,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACK,UAAU;QAChB,MAAM,QAAQ,GAAG,gCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,OAAO,GAAG,gCAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,gCAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,GAAG;QACD,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACpB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAC1B,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE;SACvC,CAAC;IACJ,CAAC;IAID;;;;;;;;OAQG;IACH,KAAK;QACH,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;CACF;AAlKD,kDAkKC"}
|
|
@@ -4,47 +4,83 @@
|
|
|
4
4
|
export declare class DyFM_Math {
|
|
5
5
|
/**
|
|
6
6
|
* returns true if the value is between the min and max
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const isBetween = DyFM_Math.between(5, 1, 10);
|
|
11
|
+
* console.log(isBetween);
|
|
12
|
+
* ```
|
|
7
13
|
*/
|
|
8
14
|
static between(value: number, minExclusive: number, maxExclusive: number): boolean;
|
|
9
15
|
/**
|
|
10
16
|
* returns true if the value is between the target and the range
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const isAround = DyFM_Math.around(5, 5, 1);
|
|
21
|
+
* console.log(isAround);
|
|
22
|
+
* ```
|
|
11
23
|
*/
|
|
12
24
|
static around(value: number, target: number, range: number): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* returns a random integer between the min and max
|
|
15
|
-
*/
|
|
16
|
-
static getRandomInt(
|
|
17
|
-
/**
|
|
18
|
-
* the minimum value (inclusive)
|
|
19
|
-
*/
|
|
20
|
-
min: number,
|
|
21
|
-
/**
|
|
22
|
-
* the maximum value (inclusive)
|
|
23
|
-
*/
|
|
24
|
-
max: number): number;
|
|
25
25
|
static readonly toFixed: typeof DyFM_Math.round;
|
|
26
26
|
/**
|
|
27
27
|
* returns a number rounded to the specified number of decimals
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const roundedNumber = DyFM_Math.round(1.2345, 2);
|
|
32
|
+
* console.log(roundedNumber); // 1.23
|
|
33
|
+
* ```
|
|
28
34
|
*/
|
|
29
35
|
static round(value: number, decimals?: number): number;
|
|
30
36
|
/**
|
|
31
37
|
* returns a number with spaces between the thousands
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const numberWithSpaces = DyFM_Math.numberWithSpaces(1000);
|
|
42
|
+
* console.log(numberWithSpaces); // '1 000'
|
|
43
|
+
* ```
|
|
32
44
|
*/
|
|
33
45
|
static numberWithSpaces(x: number): string;
|
|
34
46
|
/**
|
|
35
47
|
* returns a number with shorter units
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const numberWithShorters = DyFM_Math.numberWithShorters(1000);
|
|
52
|
+
* console.log(numberWithShorters); // '1.0k'
|
|
53
|
+
* ```
|
|
36
54
|
*/
|
|
37
55
|
static numberWithShorters(x: number): string;
|
|
38
56
|
/**
|
|
39
57
|
* returns a number with shorter units and spaces between the thousands
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const numberWithShortersAndSpaces = DyFM_Math.numberWithShortersAndSpaces(1000);
|
|
62
|
+
* console.log(numberWithShortersAndSpaces); // '1.0k'
|
|
63
|
+
* ```
|
|
40
64
|
*/
|
|
41
65
|
static numberWithShortersAndSpaces(x: number): string;
|
|
42
66
|
/**
|
|
43
67
|
* returns a number with spaces between the thousands
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const floatingNumberWithSpaces = DyFM_Math.floatingNumberWithSpaces(1234.567);
|
|
72
|
+
* console.log(floatingNumberWithSpaces); // '1 234.567'
|
|
73
|
+
* ```
|
|
44
74
|
*/
|
|
45
75
|
static floatingNumberWithSpaces(x: number): string;
|
|
46
76
|
/**
|
|
47
77
|
* returns a number with spaces between the thousands
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const decimals = DyFM_Math.decimals(1234.567, ',');
|
|
82
|
+
* console.log(decimals); // '1,234.567'
|
|
83
|
+
* ```
|
|
48
84
|
*/
|
|
49
85
|
static decimals(x: number, useSpacer?: string): string;
|
|
50
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.util.d.ts","sourceRoot":"","sources":["../../../../src/_collections/utils/math/math.util.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,SAAS;IAEpB
|
|
1
|
+
{"version":3,"file":"math.util.d.ts","sourceRoot":"","sources":["../../../../src/_collections/utils/math/math.util.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,SAAS;IAEpB;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO;IAIlF;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAIpE,MAAM,CAAC,QAAQ,CAAC,OAAO,yBAAc;IACrC;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM;IAUzD;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAI1C;;;;;;;;OAQG;IACH,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAY5C;;;;;;;;OAQG;IACH,MAAM,CAAC,2BAA2B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIrD;;;;;;;;OAQG;IACH,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAQlD;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM;CAO5D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.DyFM_Math = void 0;
|
|
4
5
|
/**
|
|
@@ -7,33 +8,36 @@ exports.DyFM_Math = void 0;
|
|
|
7
8
|
class DyFM_Math {
|
|
8
9
|
/**
|
|
9
10
|
* returns true if the value is between the min and max
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const isBetween = DyFM_Math.between(5, 1, 10);
|
|
15
|
+
* console.log(isBetween);
|
|
16
|
+
* ```
|
|
10
17
|
*/
|
|
11
18
|
static between(value, minExclusive, maxExclusive) {
|
|
12
19
|
return minExclusive < value && value < maxExclusive;
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
15
22
|
* returns true if the value is between the target and the range
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const isAround = DyFM_Math.around(5, 5, 1);
|
|
27
|
+
* console.log(isAround);
|
|
28
|
+
* ```
|
|
16
29
|
*/
|
|
17
30
|
static around(value, target, range) {
|
|
18
31
|
return this.between(value, target - range, target + range);
|
|
19
32
|
}
|
|
20
|
-
/**
|
|
21
|
-
* returns a random integer between the min and max
|
|
22
|
-
*/
|
|
23
|
-
static getRandomInt(
|
|
24
|
-
/**
|
|
25
|
-
* the minimum value (inclusive)
|
|
26
|
-
*/
|
|
27
|
-
min,
|
|
28
|
-
/**
|
|
29
|
-
* the maximum value (inclusive)
|
|
30
|
-
*/
|
|
31
|
-
max) {
|
|
32
|
-
return min + Math.round((max - min) * Math.random());
|
|
33
|
-
}
|
|
34
|
-
static toFixed = this.round;
|
|
35
33
|
/**
|
|
36
34
|
* returns a number rounded to the specified number of decimals
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const roundedNumber = DyFM_Math.round(1.2345, 2);
|
|
39
|
+
* console.log(roundedNumber); // 1.23
|
|
40
|
+
* ```
|
|
37
41
|
*/
|
|
38
42
|
static round(value, decimals = 2) {
|
|
39
43
|
if (0 <= decimals) {
|
|
@@ -46,12 +50,24 @@ class DyFM_Math {
|
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* returns a number with spaces between the thousands
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const numberWithSpaces = DyFM_Math.numberWithSpaces(1000);
|
|
57
|
+
* console.log(numberWithSpaces); // '1 000'
|
|
58
|
+
* ```
|
|
49
59
|
*/
|
|
50
60
|
static numberWithSpaces(x) {
|
|
51
61
|
return x?.toString()?.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
52
62
|
}
|
|
53
63
|
/**
|
|
54
64
|
* returns a number with shorter units
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const numberWithShorters = DyFM_Math.numberWithShorters(1000);
|
|
69
|
+
* console.log(numberWithShorters); // '1.0k'
|
|
70
|
+
* ```
|
|
55
71
|
*/
|
|
56
72
|
static numberWithShorters(x) {
|
|
57
73
|
if (x < 1000) {
|
|
@@ -69,12 +85,24 @@ class DyFM_Math {
|
|
|
69
85
|
}
|
|
70
86
|
/**
|
|
71
87
|
* returns a number with shorter units and spaces between the thousands
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const numberWithShortersAndSpaces = DyFM_Math.numberWithShortersAndSpaces(1000);
|
|
92
|
+
* console.log(numberWithShortersAndSpaces); // '1.0k'
|
|
93
|
+
* ```
|
|
72
94
|
*/
|
|
73
95
|
static numberWithShortersAndSpaces(x) {
|
|
74
96
|
return this.numberWithShorters(x)?.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
75
97
|
}
|
|
76
98
|
/**
|
|
77
99
|
* returns a number with spaces between the thousands
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const floatingNumberWithSpaces = DyFM_Math.floatingNumberWithSpaces(1234.567);
|
|
104
|
+
* console.log(floatingNumberWithSpaces); // '1 234.567'
|
|
105
|
+
* ```
|
|
78
106
|
*/
|
|
79
107
|
static floatingNumberWithSpaces(x) {
|
|
80
108
|
const parts = x?.toString()?.split('.');
|
|
@@ -83,6 +111,12 @@ class DyFM_Math {
|
|
|
83
111
|
}
|
|
84
112
|
/**
|
|
85
113
|
* returns a number with spaces between the thousands
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const decimals = DyFM_Math.decimals(1234.567, ',');
|
|
118
|
+
* console.log(decimals); // '1,234.567'
|
|
119
|
+
* ```
|
|
86
120
|
*/
|
|
87
121
|
static decimals(x, useSpacer = ',') {
|
|
88
122
|
const parts = x?.toString()?.split('.');
|
|
@@ -91,4 +125,6 @@ class DyFM_Math {
|
|
|
91
125
|
}
|
|
92
126
|
}
|
|
93
127
|
exports.DyFM_Math = DyFM_Math;
|
|
128
|
+
_a = DyFM_Math;
|
|
129
|
+
DyFM_Math.toFixed = _a.round;
|
|
94
130
|
//# sourceMappingURL=math.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.util.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/math.util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"math.util.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/math.util.ts"],"names":[],"mappings":";;;;AAGA;;GAEG;AACH,MAAa,SAAS;IAEpB;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CAAC,KAAa,EAAE,YAAoB,EAAE,YAAoB;QACtE,OAAO,YAAY,GAAG,KAAK,IAAI,KAAK,GAAG,YAAY,CAAC;IACtD,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,CAAC,KAAa,EAAE,MAAc,EAAE,KAAa;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IAC7D,CAAC;IAGD;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,KAAa,EAAE,WAAmB,CAAC;QAC9C,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;YAEvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;QAC7C,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAS;QAC/B,OAAO,CAAC,EAAE,QAAQ,EA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,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAElD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;QAEnE,OAAO,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;;AA/HH,8BAgIC;;AApGiB,iBAAO,GAAG,EAAI,CAAC,KAAK,AAAb,CAAc"}
|
|
@@ -29,15 +29,6 @@ describe('| DyFM_Math', () => {
|
|
|
29
29
|
expect(math_util_1.DyFM_Math.around(7, 5, 1)).toBeFalse();
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
describe('| getRandomInt', () => {
|
|
33
|
-
it('| should return an integer within the specified range', () => {
|
|
34
|
-
const min = 1;
|
|
35
|
-
const max = 10;
|
|
36
|
-
const result = math_util_1.DyFM_Math.getRandomInt(min, max);
|
|
37
|
-
expect(result).toBeGreaterThanOrEqual(min);
|
|
38
|
-
expect(result).toBeLessThanOrEqual(max);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
32
|
describe('| round', () => {
|
|
42
33
|
it('| should round a number to the specified number of decimals', () => {
|
|
43
34
|
expect(math_util_1.DyFM_Math.round(1.2345, 2)).toBe(1.23);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.util.spec.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/math.util.spec.ts"],"names":[],"mappings":";;AACA,2CAAwC;AAExC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAE3B,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;YAChF,MAAM,CAAC,qBAAS,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,EAA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ACvD,MAAM,CAAC,qBAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC5D,MAAM,CAAC,qBAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC"}
|
|
@@ -5,6 +5,16 @@ import { DyFM_RandomWeight } from '../../../_models/interfaces/random-weight.int
|
|
|
5
5
|
export declare class DyFM_Random {
|
|
6
6
|
/**
|
|
7
7
|
* returns a random weighted integer between the min and max
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const randomWeightedInt = DyFM_Random.getRandomWeightedInt(1, 10, [
|
|
12
|
+
* { chance: 0.1, result: 1 },
|
|
13
|
+
* { chance: 0.3, result: 2 },
|
|
14
|
+
* { chance: 0.6, result: 3 }
|
|
15
|
+
* ]);
|
|
16
|
+
* console.log(randomWeightedInt);
|
|
17
|
+
* ```
|
|
8
18
|
*/
|
|
9
19
|
static getRandomWeightedInt(min: number, max: number, weights: DyFM_RandomWeight<number>[]): number;
|
|
10
20
|
/**
|
|
@@ -12,12 +22,24 @@ export declare class DyFM_Random {
|
|
|
12
22
|
* @param min - the minimum value (inclusive)
|
|
13
23
|
* @param max - the maximum value (inclusive)
|
|
14
24
|
* @returns a random integer between the min and max
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const randomInt = DyFM_Random.getRandomInt(1, 10);
|
|
29
|
+
* console.log(randomInt); // 5
|
|
30
|
+
* ```
|
|
15
31
|
*/
|
|
16
32
|
static getRandomInt(min: number, max: number): number;
|
|
17
33
|
/**
|
|
18
34
|
* returns null if list is empty
|
|
19
35
|
* @param list
|
|
20
36
|
* @returns
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const randomListElement = DyFM_Random.getRandomListElement([1, 2, 3, 4, 5]);
|
|
41
|
+
* console.log(randomListElement); // 3
|
|
42
|
+
* ```
|
|
21
43
|
*/
|
|
22
44
|
static getRandomListElement<T>(list: T[]): T | null;
|
|
23
45
|
/**
|
|
@@ -25,6 +47,14 @@ export declare class DyFM_Random {
|
|
|
25
47
|
* (returns null if list is empty)
|
|
26
48
|
* @param weights
|
|
27
49
|
* @returns
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const randomWeightedElement = DyFM_Random.getRandomWeighted([
|
|
54
|
+
* { chance: 0.1, result: '1' },
|
|
55
|
+
* { chance: 0.3, result: '2' },
|
|
56
|
+
* { chance: 0.6, result: '3' }
|
|
57
|
+
* ]);
|
|
28
58
|
*/
|
|
29
59
|
static getRandomWeighted<T>(weights: DyFM_RandomWeight<T>[]): T | null;
|
|
30
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.util.d.ts","sourceRoot":"","sources":["../../../../src/_collections/utils/math/random.util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAGxF;;GAEG;AACH,qBAAa,WAAW;IACtB
|
|
1
|
+
{"version":3,"file":"random.util.d.ts","sourceRoot":"","sources":["../../../../src/_collections/utils/math/random.util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAGxF;;GAEG;AACH,qBAAa,WAAW;IACtB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,oBAAoB,CACzB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,GACnC,MAAM;IA6BT;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI;IAQnD;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI;CAkCvE"}
|
|
@@ -8,6 +8,16 @@ const log_util_1 = require("../log.util");
|
|
|
8
8
|
class DyFM_Random {
|
|
9
9
|
/**
|
|
10
10
|
* returns a random weighted integer between the min and max
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const randomWeightedInt = DyFM_Random.getRandomWeightedInt(1, 10, [
|
|
15
|
+
* { chance: 0.1, result: 1 },
|
|
16
|
+
* { chance: 0.3, result: 2 },
|
|
17
|
+
* { chance: 0.6, result: 3 }
|
|
18
|
+
* ]);
|
|
19
|
+
* console.log(randomWeightedInt);
|
|
20
|
+
* ```
|
|
11
21
|
*/
|
|
12
22
|
static getRandomWeightedInt(min, max, weights) {
|
|
13
23
|
weights = weights.sort((a, b) => b.chance - a.chance);
|
|
@@ -37,6 +47,12 @@ class DyFM_Random {
|
|
|
37
47
|
* @param min - the minimum value (inclusive)
|
|
38
48
|
* @param max - the maximum value (inclusive)
|
|
39
49
|
* @returns a random integer between the min and max
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const randomInt = DyFM_Random.getRandomInt(1, 10);
|
|
54
|
+
* console.log(randomInt); // 5
|
|
55
|
+
* ```
|
|
40
56
|
*/
|
|
41
57
|
static getRandomInt(min, max) {
|
|
42
58
|
return min + Math.round((max - min) * Math.random());
|
|
@@ -45,6 +61,12 @@ class DyFM_Random {
|
|
|
45
61
|
* returns null if list is empty
|
|
46
62
|
* @param list
|
|
47
63
|
* @returns
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const randomListElement = DyFM_Random.getRandomListElement([1, 2, 3, 4, 5]);
|
|
68
|
+
* console.log(randomListElement); // 3
|
|
69
|
+
* ```
|
|
48
70
|
*/
|
|
49
71
|
static getRandomListElement(list) {
|
|
50
72
|
if (0 < list.length) {
|
|
@@ -59,6 +81,14 @@ class DyFM_Random {
|
|
|
59
81
|
* (returns null if list is empty)
|
|
60
82
|
* @param weights
|
|
61
83
|
* @returns
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const randomWeightedElement = DyFM_Random.getRandomWeighted([
|
|
88
|
+
* { chance: 0.1, result: '1' },
|
|
89
|
+
* { chance: 0.3, result: '2' },
|
|
90
|
+
* { chance: 0.6, result: '3' }
|
|
91
|
+
* ]);
|
|
62
92
|
*/
|
|
63
93
|
static getRandomWeighted(weights) {
|
|
64
94
|
if (!weights?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.util.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/random.util.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AAEvC;;GAEG;AACH,MAAa,WAAW;IACtB
|
|
1
|
+
{"version":3,"file":"random.util.js","sourceRoot":"","sources":["../../../../src/_collections/utils/math/random.util.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AAEvC;;GAEG;AACH,MAAa,WAAW;IACtB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,oBAAoB,CACzB,GAAW,EACX,GAAW,EACX,OAAoC;QAEpC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAU,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;QAC9D,IAAI,eAAe,GAAG,CAAC,CAAC;QAExB,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAQ,EAAE,GAAG,eA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AAmE,CAAC,CAAC;YACpF,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlID,kCAkIC"}
|
|
@@ -9,6 +9,12 @@ export declare class DyFM_Trigonometry {
|
|
|
9
9
|
* @param c átfogó
|
|
10
10
|
* @param angle a befogó oldallal szemközti szög (fokban)
|
|
11
11
|
* @returns befogó
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const clamp = DyFM_Trigonometry.getClamp(10, 30);
|
|
16
|
+
* console.log(clamp); // 5
|
|
17
|
+
* ```
|
|
12
18
|
*/
|
|
13
19
|
static getClamp(c: number, angle?: number): number;
|
|
14
20
|
/**
|
|
@@ -17,6 +23,12 @@ export declare class DyFM_Trigonometry {
|
|
|
17
23
|
* @param a befogó
|
|
18
24
|
* @param c átfogó
|
|
19
25
|
* @returns befogó
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const clamp = DyFM_Trigonometry.getClampByClampAndHypotenuse(6, 10);
|
|
30
|
+
* console.log(clamp); // 8
|
|
31
|
+
* ```
|
|
20
32
|
*/
|
|
21
33
|
static getClampByClampAndHypotenuse(a: number, c: number): number;
|
|
22
34
|
/**
|
|
@@ -27,18 +39,36 @@ export declare class DyFM_Trigonometry {
|
|
|
27
39
|
* @param a egyik befogó
|
|
28
40
|
* @param b másik befogó
|
|
29
41
|
* @returns átfogó
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const hypotenuse = DyFM_Trigonometry.getHypotenuse(3, 4);
|
|
46
|
+
* console.log(hypotenuse); // 5
|
|
47
|
+
* ```
|
|
30
48
|
*/
|
|
31
49
|
static getHypotenuse(a: number, b?: number): number;
|
|
32
50
|
/**
|
|
33
51
|
* Szög fokmértéket átalakítja radiánsra
|
|
34
52
|
* @param angle szög fok
|
|
35
53
|
* @returns szög radiáns
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const radians = DyFM_Trigonometry.angleToRadians(180);
|
|
58
|
+
* console.log(radians); // 3.141592653589793
|
|
59
|
+
* ```
|
|
36
60
|
*/
|
|
37
61
|
static angleToRadians(angle: number): number;
|
|
38
62
|
/**
|
|
39
63
|
* Szög radiáns mértéket átalakítja fokra
|
|
40
64
|
* @param radians szög radiáns
|
|
41
65
|
* @returns szög fok
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const angle = DyFM_Trigonometry.radiansToAngle(3.141592653589793);
|
|
70
|
+
* console.log(angle); // 180
|
|
71
|
+
* ```
|
|
42
72
|
*/
|
|
43
73
|
static radiansToAngle(radians: number): number;
|
|
44
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigonometry.util.d.ts","sourceRoot":"","sources":["../../../../src/_collections/utils/math/trigonometry.util.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAC1C,MAAM,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACvC,qBAAa,iBAAiB;IAE5B
|
|
1
|
+
{"version":3,"file":"trigonometry.util.d.ts","sourceRoot":"","sources":["../../../../src/_collections/utils/math/trigonometry.util.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAC1C,MAAM,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACvC,qBAAa,iBAAiB;IAE5B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAMlD;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,4BAA4B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM;IAYjE;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAMnD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI5C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAG/C"}
|