@futdevpro/fsm-dynamo 1.10.37 → 1.10.39
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/.github/workflows/main.yml +11 -51
- package/build/_collections/constants/error-defaults.const.d.ts +8 -0
- package/build/_collections/constants/error-defaults.const.d.ts.map +1 -1
- package/build/_collections/constants/error-defaults.const.js +8 -0
- package/build/_collections/constants/error-defaults.const.js.map +1 -1
- package/build/_collections/constants/global-settings.const.d.ts +8 -0
- package/build/_collections/constants/global-settings.const.d.ts.map +1 -1
- package/build/_collections/constants/global-settings.const.js +9 -0
- package/build/_collections/constants/global-settings.const.js.map +1 -1
- package/build/_collections/constants/numbers.const.d.ts +32 -0
- package/build/_collections/constants/numbers.const.d.ts.map +1 -1
- package/build/_collections/constants/numbers.const.js +32 -0
- package/build/_collections/constants/numbers.const.js.map +1 -1
- package/build/_collections/constants/times.const.d.ts +31 -0
- package/build/_collections/constants/times.const.d.ts.map +1 -1
- package/build/_collections/constants/times.const.js +31 -0
- package/build/_collections/constants/times.const.js.map +1 -1
- package/build/_collections/utils/array.util.d.ts +136 -7
- package/build/_collections/utils/array.util.d.ts.map +1 -1
- package/build/_collections/utils/array.util.js +132 -2
- package/build/_collections/utils/array.util.js.map +1 -1
- package/build/_collections/utils/array.util.spec.js.map +1 -1
- package/build/_collections/utils/log.util.d.ts +123 -0
- package/build/_collections/utils/log.util.d.ts.map +1 -1
- package/build/_collections/utils/log.util.js +123 -0
- package/build/_collections/utils/log.util.js.map +1 -1
- package/build/_collections/utils/math/box-bounds.spec.js +2 -5
- package/build/_collections/utils/math/box-bounds.spec.js.map +1 -1
- package/build/_collections/utils/math/box-bounds.util.d.ts +52 -6
- package/build/_collections/utils/math/box-bounds.util.d.ts.map +1 -1
- package/build/_collections/utils/math/box-bounds.util.js +57 -5
- package/build/_collections/utils/math/box-bounds.util.js.map +1 -1
- package/build/_collections/utils/math/box-bounds.util.spec.js +1 -1
- package/build/_collections/utils/math/box-bounds.util.spec.js.map +1 -1
- package/build/_collections/utils/math/math.util.d.ts +30 -0
- package/build/_collections/utils/math/math.util.d.ts.map +1 -1
- package/build/_collections/utils/math/math.util.js +30 -0
- package/build/_collections/utils/math/math.util.js.map +1 -1
- package/build/_collections/utils/math/random.util.d.ts +19 -2
- package/build/_collections/utils/math/random.util.d.ts.map +1 -1
- package/build/_collections/utils/math/random.util.js +22 -0
- package/build/_collections/utils/math/random.util.js.map +1 -1
- package/build/_collections/utils/math/random.util.spec.js.map +1 -1
- package/build/_collections/utils/math/vector2.util.d.ts +142 -20
- package/build/_collections/utils/math/vector2.util.d.ts.map +1 -1
- package/build/_collections/utils/math/vector2.util.js +126 -0
- package/build/_collections/utils/math/vector2.util.js.map +1 -1
- package/build/_collections/utils/round-list.util.d.ts +36 -1
- package/build/_collections/utils/round-list.util.d.ts.map +1 -1
- package/build/_collections/utils/round-list.util.js +35 -0
- package/build/_collections/utils/round-list.util.js.map +1 -1
- package/build/_collections/utils/shared.util.js.map +1 -1
- package/build/_collections/utils/stack.util.js +3 -3
- package/build/_collections/utils/stack.util.js.map +1 -1
- package/build/_collections/utils/string.util.d.ts +8 -1
- package/build/_collections/utils/string.util.d.ts.map +1 -1
- package/build/_collections/utils/string.util.js +8 -1
- package/build/_collections/utils/string.util.js.map +1 -1
- package/build/_collections/utils/time.util.d.ts +29 -0
- package/build/_collections/utils/time.util.d.ts.map +1 -1
- package/build/_collections/utils/time.util.js +29 -0
- package/build/_collections/utils/time.util.js.map +1 -1
- package/build/_collections/utils/type-cloning-facility.util.d.ts +29 -3
- package/build/_collections/utils/type-cloning-facility.util.d.ts.map +1 -1
- package/build/_collections/utils/type-cloning-facility.util.js +53 -3
- package/build/_collections/utils/type-cloning-facility.util.js.map +1 -1
- package/build/_collections/utils/utilities.util.d.ts +49 -2
- package/build/_collections/utils/utilities.util.d.ts.map +1 -1
- package/build/_collections/utils/utilities.util.js +53 -1
- package/build/_collections/utils/utilities.util.js.map +1 -1
- package/build/_collections/utils/utilities.util.spec.js.map +1 -1
- package/build/_collections/utils/uuid.util.d.ts +5 -0
- package/build/_collections/utils/uuid.util.d.ts.map +1 -1
- package/build/_collections/utils/uuid.util.js +5 -0
- package/build/_collections/utils/uuid.util.js.map +1 -1
- package/build/_enums/basic-property-type.enum.d.ts +8 -0
- package/build/_enums/basic-property-type.enum.d.ts.map +1 -1
- package/build/_enums/basic-property-type.enum.js +8 -0
- package/build/_enums/basic-property-type.enum.js.map +1 -1
- package/build/_enums/data-model-type.enum.d.ts +8 -4
- package/build/_enums/data-model-type.enum.d.ts.map +1 -1
- package/build/_enums/data-model-type.enum.js +8 -4
- package/build/_enums/data-model-type.enum.js.map +1 -1
- package/build/_enums/environment-flag.enum.d.ts +18 -0
- package/build/_enums/environment-flag.enum.d.ts.map +1 -1
- package/build/_enums/environment-flag.enum.js +18 -0
- package/build/_enums/environment-flag.enum.js.map +1 -1
- package/build/_enums/error-level.enum.d.ts +10 -0
- package/build/_enums/error-level.enum.d.ts.map +1 -1
- package/build/_enums/error-level.enum.js +10 -0
- package/build/_enums/error-level.enum.js.map +1 -1
- package/build/_enums/http-call-type.enum.d.ts +6 -2
- package/build/_enums/http-call-type.enum.d.ts.map +1 -1
- package/build/_enums/http-call-type.enum.js +6 -2
- package/build/_enums/http-call-type.enum.js.map +1 -1
- package/build/_enums/http-response-type.enum.d.ts +8 -0
- package/build/_enums/http-response-type.enum.d.ts.map +1 -1
- package/build/_enums/http-response-type.enum.js +8 -0
- package/build/_enums/http-response-type.enum.js.map +1 -1
- package/build/_enums/log-style.enum.d.ts +8 -0
- package/build/_enums/log-style.enum.d.ts.map +1 -1
- package/build/_enums/log-style.enum.js +8 -0
- package/build/_enums/log-style.enum.js.map +1 -1
- package/build/_enums/time/day-of-week.enum.d.ts +13 -1
- package/build/_enums/time/day-of-week.enum.d.ts.map +1 -1
- package/build/_enums/time/day-of-week.enum.js +13 -1
- package/build/_enums/time/day-of-week.enum.js.map +1 -1
- package/build/_enums/time/month.enum.d.ts +8 -0
- package/build/_enums/time/month.enum.d.ts.map +1 -1
- package/build/_enums/time/month.enum.js +8 -0
- package/build/_enums/time/month.enum.js.map +1 -1
- package/build/_enums/time/relative-date.enum.d.ts +10 -0
- package/build/_enums/time/relative-date.enum.d.ts.map +1 -1
- package/build/_enums/time/relative-date.enum.js +10 -0
- package/build/_enums/time/relative-date.enum.js.map +1 -1
- package/build/_models/control-models/data-model-params.control-model.d.ts +4 -4
- 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.map +1 -1
- 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.map +1 -1
- package/build/_models/control-models/error.control-model.spec.js.map +1 -1
- package/build/_models/interfaces/box-bounds.interface.d.ts +8 -0
- package/build/_models/interfaces/box-bounds.interface.d.ts.map +1 -0
- package/build/_models/interfaces/box-bounds.interface.js +3 -0
- package/build/_models/interfaces/box-bounds.interface.js.map +1 -0
- package/build/_models/interfaces/environment/global-settings.interface.d.ts +1 -0
- package/build/_models/interfaces/environment/global-settings.interface.d.ts.map +1 -1
- package/build/_models/interfaces/route-settings.interface.d.ts +6 -1
- package/build/_models/interfaces/route-settings.interface.d.ts.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.d.ts +11 -17
- package/build/_modules/crypto/_collections/crypto.util.d.ts.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.js +74 -58
- package/build/_modules/crypto/_collections/crypto.util.js.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.spec.js +390 -0
- package/build/_modules/crypto/_collections/crypto.util.spec.js.map +1 -1
- package/build/_modules/custom-data/_collections/cud-module-settings.const.d.ts +6 -0
- package/build/_modules/custom-data/_collections/cud-module-settings.const.d.ts.map +1 -1
- package/build/_modules/custom-data/_collections/cud-module-settings.const.js +6 -0
- package/build/_modules/custom-data/_collections/cud-module-settings.const.js.map +1 -1
- package/build/_modules/custom-data/_models/cud.data-model.d.ts +3 -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 +3 -0
- package/build/_modules/custom-data/_models/cud.data-model.js.map +1 -1
- package/build/_modules/location/_collections/loc-country-divisions.const.d.ts +1 -0
- package/build/_modules/location/_collections/loc-country-divisions.const.d.ts.map +1 -1
- package/build/_modules/location/_collections/loc-country-divisions.const.js +1 -0
- package/build/_modules/location/_collections/loc-country-divisions.const.js.map +1 -1
- package/build/_modules/location/_collections/loc-regions.util.d.ts +4 -0
- package/build/_modules/location/_collections/loc-regions.util.d.ts.map +1 -1
- package/build/_modules/location/_collections/loc-regions.util.js +4 -0
- package/build/_modules/location/_collections/loc-regions.util.js.map +1 -1
- package/build/_modules/location/_collections/loc.util.d.ts +9 -0
- package/build/_modules/location/_collections/loc.util.d.ts.map +1 -1
- package/build/_modules/location/_collections/loc.util.js +9 -0
- package/build/_modules/location/_collections/loc.util.js.map +1 -1
- package/build/_modules/location/_enums/loc-region.enum.d.ts +3 -0
- package/build/_modules/location/_enums/loc-region.enum.d.ts.map +1 -1
- package/build/_modules/location/_enums/loc-region.enum.js +3 -0
- package/build/_modules/location/_enums/loc-region.enum.js.map +1 -1
- package/build/_modules/location/_enums/loc-sub-region.enum.d.ts +3 -0
- package/build/_modules/location/_enums/loc-sub-region.enum.d.ts.map +1 -1
- package/build/_modules/location/_enums/loc-sub-region.enum.js +3 -0
- package/build/_modules/location/_enums/loc-sub-region.enum.js.map +1 -1
- package/build/_modules/location/_enums/loc-subdivision-region-type.enum.d.ts +37 -34
- package/build/_modules/location/_enums/loc-subdivision-region-type.enum.d.ts.map +1 -1
- package/build/_modules/location/_enums/loc-subdivision-region-type.enum.js +3 -0
- package/build/_modules/location/_enums/loc-subdivision-region-type.enum.js.map +1 -1
- package/build/_modules/location/_models/loc-coordinates.interface.d.ts +1 -0
- package/build/_modules/location/_models/loc-coordinates.interface.d.ts.map +1 -1
- package/build/_modules/open-ai/_enums/open-ai-model.enum.d.ts +10 -7
- package/build/_modules/open-ai/_enums/open-ai-model.enum.d.ts.map +1 -1
- package/build/_modules/open-ai/_enums/open-ai-model.enum.js +3 -0
- package/build/_modules/open-ai/_enums/open-ai-model.enum.js.map +1 -1
- package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.d.ts +3 -0
- package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.d.ts.map +1 -1
- package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.js +3 -0
- package/build/_modules/pipe/_enums/pip-range-pipe-setting.enum.js.map +1 -1
- package/build/_modules/pipe/_enums/pip.enum.d.ts +14 -0
- package/build/_modules/pipe/_enums/pip.enum.d.ts.map +1 -1
- package/build/_modules/pipe/_enums/pip.enum.js +11 -0
- package/build/_modules/pipe/_enums/pip.enum.js.map +1 -1
- package/build/_modules/socket/_enums/sck-event-key.enum.d.ts +3 -0
- package/build/_modules/socket/_enums/sck-event-key.enum.d.ts.map +1 -1
- package/build/_modules/socket/_enums/sck-event-key.enum.js +3 -0
- package/build/_modules/socket/_enums/sck-event-key.enum.js.map +1 -1
- package/build/_modules/socket/_models/sck-client-params.control-model.d.ts +12 -0
- package/build/_modules/socket/_models/sck-client-params.control-model.d.ts.map +1 -1
- package/build/_modules/socket/_models/sck-client-params.control-model.js +12 -0
- package/build/_modules/socket/_models/sck-client-params.control-model.js.map +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.d.ts +12 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.d.ts.map +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.js +12 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.js.map +1 -1
- package/build/_modules/socket/_services/sck-client.service-base.d.ts +4 -0
- package/build/_modules/socket/_services/sck-client.service-base.d.ts.map +1 -1
- package/build/_modules/socket/_services/sck-client.service-base.js +4 -0
- package/build/_modules/socket/_services/sck-client.service-base.js.map +1 -1
- package/build/_modules/test/_collections/tst-module-settings.const.d.ts +9 -0
- package/build/_modules/test/_collections/tst-module-settings.const.d.ts.map +1 -1
- package/build/_modules/test/_collections/tst-module-settings.const.js +9 -0
- package/build/_modules/test/_collections/tst-module-settings.const.js.map +1 -1
- package/build/_modules/usage/_models/usg-action.control-model.d.ts +13 -0
- package/build/_modules/usage/_models/usg-action.control-model.d.ts.map +1 -1
- package/build/_modules/usage/_models/usg-action.control-model.js +13 -0
- package/build/_modules/usage/_models/usg-action.control-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.d.ts +14 -0
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.d.ts.map +1 -1
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.js +14 -0
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-data.control-model.d.ts +16 -0
- package/build/_modules/usage/_models/usg-data.control-model.d.ts.map +1 -1
- package/build/_modules/usage/_models/usg-data.control-model.js +16 -0
- package/build/_modules/usage/_models/usg-data.control-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-session.data-model.d.ts +17 -0
- package/build/_modules/usage/_models/usg-session.data-model.d.ts.map +1 -1
- package/build/_modules/usage/_models/usg-session.data-model.js +17 -0
- package/build/_modules/usage/_models/usg-session.data-model.js.map +1 -1
- package/build/_modules/usage/_models/usg-session.data-model.spec.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.10.39.tgz +0 -0
- package/package.json +9 -5
- package/src/_collections/constants/error-defaults.const.ts +8 -0
- package/src/_collections/constants/global-settings.const.ts +12 -2
- package/src/_collections/constants/numbers.const.ts +32 -0
- package/src/_collections/constants/times.const.ts +37 -0
- package/src/_collections/utils/array.util.spec.ts +36 -38
- package/src/_collections/utils/array.util.ts +146 -12
- package/src/_collections/utils/log.util.ts +126 -2
- package/src/_collections/utils/math/box-bounds.spec.ts +8 -13
- package/src/_collections/utils/math/box-bounds.util.spec.ts +3 -3
- package/src/_collections/utils/math/box-bounds.util.ts +65 -12
- package/src/_collections/utils/math/math.util.ts +30 -6
- package/src/_collections/utils/math/random.util.spec.ts +7 -7
- package/src/_collections/utils/math/random.util.ts +27 -4
- package/src/_collections/utils/math/vector2.util.ts +148 -21
- package/src/_collections/utils/round-list.util.ts +36 -3
- package/src/_collections/utils/shared.util.ts +17 -17
- package/src/_collections/utils/stack.util.ts +6 -6
- package/src/_collections/utils/string.util.ts +8 -1
- package/src/_collections/utils/time.util.ts +37 -2
- package/src/_collections/utils/type-cloning-facility.util.ts +57 -8
- package/src/_collections/utils/utilities.util.spec.ts +2 -2
- package/src/_collections/utils/utilities.util.ts +61 -8
- package/src/_collections/utils/uuid.util.ts +5 -0
- package/src/_enums/basic-property-type.enum.ts +8 -0
- package/src/_enums/data-model-type.enum.ts +11 -6
- package/src/_enums/environment-flag.enum.ts +18 -0
- package/src/_enums/error-level.enum.ts +10 -0
- package/src/_enums/http-call-type.enum.ts +6 -2
- package/src/_enums/http-response-type.enum.ts +8 -0
- package/src/_enums/log-style.enum.ts +8 -0
- package/src/_enums/time/day-of-week.enum.ts +13 -1
- package/src/_enums/time/month.enum.ts +8 -0
- package/src/_enums/time/relative-date.enum.ts +10 -0
- package/src/_models/control-models/data-model-params.control-model.ts +6 -6
- package/src/_models/control-models/data-property-params.control-model.ts +1 -1
- package/src/_models/control-models/error.control-model.spec.ts +2 -2
- package/src/_models/interfaces/box-bounds.interface.ts +8 -0
- package/src/_models/interfaces/environment/global-settings.interface.ts +2 -0
- package/src/_models/interfaces/route-settings.interface.ts +6 -1
- package/src/_modules/crypto/_collections/crypto.util.spec.ts +428 -0
- package/src/_modules/crypto/_collections/crypto.util.ts +88 -52
- package/src/_modules/custom-data/_collections/cud-module-settings.const.ts +6 -0
- package/src/_modules/custom-data/_models/cud.data-model.ts +3 -0
- package/src/_modules/location/_collections/loc-country-divisions.const.ts +2 -1
- package/src/_modules/location/_collections/loc-regions.util.ts +4 -0
- package/src/_modules/location/_collections/loc.util.ts +13 -5
- package/src/_modules/location/_enums/loc-region.enum.ts +3 -0
- package/src/_modules/location/_enums/loc-sub-region.enum.ts +3 -0
- package/src/_modules/location/_enums/loc-subdivision-region-type.enum.ts +37 -34
- package/src/_modules/location/_models/loc-coordinates.interface.ts +1 -0
- package/src/_modules/open-ai/_enums/open-ai-model.enum.ts +11 -8
- package/src/_modules/pipe/_enums/pip-range-pipe-setting.enum.ts +3 -0
- package/src/_modules/pipe/_enums/pip.enum.ts +17 -3
- package/src/_modules/socket/_enums/sck-event-key.enum.ts +3 -0
- package/src/_modules/socket/_models/sck-client-params.control-model.ts +12 -0
- package/src/_modules/socket/_models/sck-socket-event.control-model.ts +12 -1
- package/src/_modules/socket/_services/sck-client.service-base.ts +4 -0
- package/src/_modules/test/_collections/tst-module-settings.const.ts +9 -0
- package/src/_modules/usage/_models/usg-action.control-model.ts +13 -0
- package/src/_modules/usage/_models/usg-daily-usage-data.control-model.ts +14 -0
- package/src/_modules/usage/_models/usg-data.control-model.ts +16 -0
- package/src/_modules/usage/_models/usg-session.data-model.spec.ts +2 -1
- package/src/_modules/usage/_models/usg-session.data-model.ts +17 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +1 -0
- package/futdevpro-fsm-dynamo-01.10.37.tgz +0 -0
|
@@ -50,10 +50,25 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// these are created as soft objects to avoid changing instances with DyFM_Vector2 instance functions
|
|
53
|
+
/**
|
|
54
|
+
* zero vector
|
|
55
|
+
*/
|
|
53
56
|
static readonly zero: DyFM_Vector2 = { x: 0, y: 0 };
|
|
57
|
+
/**
|
|
58
|
+
* up vector
|
|
59
|
+
*/
|
|
54
60
|
static readonly up: DyFM_Vector2 = { x: 0, y: 1 };
|
|
61
|
+
/**
|
|
62
|
+
* down vector
|
|
63
|
+
*/
|
|
55
64
|
static readonly down: DyFM_Vector2 = { x: 0, y: -1 };
|
|
65
|
+
/**
|
|
66
|
+
* right vector
|
|
67
|
+
*/
|
|
56
68
|
static readonly right: DyFM_Vector2 = { x: 1, y: 0 };
|
|
69
|
+
/**
|
|
70
|
+
* left vector
|
|
71
|
+
*/
|
|
57
72
|
static readonly left: DyFM_Vector2 = { x: -1, y: 0 };
|
|
58
73
|
|
|
59
74
|
constructor(
|
|
@@ -78,42 +93,54 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
78
93
|
this.calcMagnitude();
|
|
79
94
|
}
|
|
80
95
|
|
|
96
|
+
/**
|
|
97
|
+
* returns true if the vector is constructed
|
|
98
|
+
*/
|
|
81
99
|
constructed?(): boolean {
|
|
82
100
|
return true;
|
|
83
101
|
}
|
|
84
102
|
|
|
103
|
+
/**
|
|
104
|
+
* returns the distance between two vectors
|
|
105
|
+
*/
|
|
85
106
|
static distance(a: DyFM_Vector2, b: DyFM_Vector2): number {
|
|
86
107
|
return this.minus(a, b).magintude;
|
|
87
108
|
}
|
|
88
|
-
distance
|
|
109
|
+
distance(to: DyFM_Vector2): number {
|
|
89
110
|
return DyFM_Vector2_Util.distance(this, to);
|
|
90
111
|
}
|
|
91
112
|
|
|
113
|
+
/**
|
|
114
|
+
* returns a new vector with the negative values of the original vector
|
|
115
|
+
*/
|
|
92
116
|
static minus(a: DyFM_Vector2, minusB: DyFM_Vector2): DyFM_Vector2_Util {
|
|
93
117
|
return this.plus(a, this.negative(minusB));
|
|
94
118
|
}
|
|
95
|
-
minus
|
|
119
|
+
minus(vector: DyFM_Vector2): this {
|
|
96
120
|
this.plus(DyFM_Vector2_Util.negative(vector));
|
|
97
121
|
|
|
98
122
|
return this;
|
|
99
123
|
}
|
|
100
124
|
|
|
125
|
+
/**
|
|
126
|
+
* returns a new vector with the sum of two vectors
|
|
127
|
+
*/
|
|
101
128
|
static plus(a: DyFM_Vector2, plusB: DyFM_Vector2): DyFM_Vector2_Util {
|
|
102
129
|
return new DyFM_Vector2_Util(a.x + plusB.x, a.y + plusB.y);
|
|
103
130
|
}
|
|
104
|
-
plus
|
|
131
|
+
plus(vector: DyFM_Vector2): this {
|
|
105
132
|
this.newValues(DyFM_Vector2_Util.plus(this, vector));
|
|
106
133
|
|
|
107
134
|
return this;
|
|
108
135
|
}
|
|
109
136
|
static readonly add = this.plus;
|
|
110
|
-
readonly add
|
|
137
|
+
readonly add = this.plus;
|
|
111
138
|
|
|
112
139
|
/** returns new multiplied Vector2 */
|
|
113
140
|
static multiply(v: DyFM_Vector2, n: number): DyFM_Vector2_Util {
|
|
114
141
|
return new DyFM_Vector2_Util(v.x * n, v.y * n);
|
|
115
142
|
}
|
|
116
|
-
multiply
|
|
143
|
+
multiply(n: number): this {
|
|
117
144
|
return this.newValues(DyFM_Vector2_Util.multiply(this, n));
|
|
118
145
|
}
|
|
119
146
|
|
|
@@ -121,7 +148,7 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
121
148
|
static divide(v: DyFM_Vector2, divideBy: number): DyFM_Vector2_Util {
|
|
122
149
|
return new DyFM_Vector2_Util(v.x / divideBy, v.y / divideBy);
|
|
123
150
|
}
|
|
124
|
-
divide
|
|
151
|
+
divide(n: number): this {
|
|
125
152
|
this.newValues(DyFM_Vector2_Util.divide(this, n));
|
|
126
153
|
|
|
127
154
|
return this;
|
|
@@ -131,29 +158,38 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
131
158
|
return new DyFM_Vector2_Util(-v.x, -v.y);
|
|
132
159
|
}
|
|
133
160
|
/** this returns a new instance */
|
|
134
|
-
getNegative
|
|
161
|
+
getNegative(): DyFM_Vector2_Util {
|
|
135
162
|
return DyFM_Vector2_Util.negative(this);
|
|
136
163
|
}
|
|
137
|
-
negate
|
|
164
|
+
negate(): this {
|
|
138
165
|
this.newValues(DyFM_Vector2_Util.negative(this));
|
|
139
166
|
|
|
140
167
|
return this;
|
|
141
168
|
}
|
|
142
169
|
|
|
170
|
+
/**
|
|
171
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
172
|
+
*/
|
|
143
173
|
static rebase(v: DyFM_Vector2, baseFrom: DyFM_Vector2, baseTo: DyFM_Vector2): DyFM_Vector2_Util {
|
|
144
174
|
return this.plus(v, this.minus(baseTo, baseFrom));
|
|
145
175
|
}
|
|
146
|
-
rebase
|
|
176
|
+
rebase(baseFrom: DyFM_Vector2, baseTo: DyFM_Vector2): this {
|
|
147
177
|
this.newValues(DyFM_Vector2_Util.rebase(this, baseFrom, baseTo));
|
|
148
178
|
|
|
149
179
|
return this;
|
|
150
180
|
}
|
|
151
181
|
|
|
182
|
+
/**
|
|
183
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
184
|
+
*/
|
|
152
185
|
static rotate(vector: DyFM_Vector2, angle: number): DyFM_Vector2_Util {
|
|
153
186
|
const rad = DyFM_Trigonometry.angleToRadians(angle);
|
|
154
187
|
|
|
155
188
|
return this.rotateRad(vector, rad);
|
|
156
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
192
|
+
*/
|
|
157
193
|
static rotateRad(vector: DyFM_Vector2, rad: number): DyFM_Vector2_Util {
|
|
158
194
|
const cos = Math.cos(rad);
|
|
159
195
|
const sin = Math.sin(rad);
|
|
@@ -162,23 +198,35 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
162
198
|
|
|
163
199
|
return new DyFM_Vector2_Util(newX, newY);
|
|
164
200
|
}
|
|
165
|
-
|
|
201
|
+
/**
|
|
202
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
203
|
+
*/
|
|
204
|
+
rotate(angle: number): this {
|
|
166
205
|
this.newValues(DyFM_Vector2_Util.rotate(this, angle));
|
|
167
206
|
|
|
168
207
|
return this;
|
|
169
208
|
}
|
|
170
|
-
|
|
209
|
+
/**
|
|
210
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
211
|
+
*/
|
|
212
|
+
rotateRad(rad: number): this {
|
|
171
213
|
this.newValues(DyFM_Vector2_Util.rotateRad(this, rad));
|
|
172
214
|
|
|
173
215
|
return this;
|
|
174
216
|
}
|
|
175
217
|
|
|
218
|
+
/**
|
|
219
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
220
|
+
*/
|
|
176
221
|
newValues(newV: DyFM_Vector2): this {
|
|
177
222
|
this.newXY(newV.x, newV.y);
|
|
178
223
|
|
|
179
224
|
return this;
|
|
180
225
|
}
|
|
181
|
-
|
|
226
|
+
/**
|
|
227
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
228
|
+
*/
|
|
229
|
+
newXY(newX: number, newY: number): this {
|
|
182
230
|
this._x = newX;
|
|
183
231
|
this._y = newY;
|
|
184
232
|
|
|
@@ -186,89 +234,159 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
186
234
|
|
|
187
235
|
return this;
|
|
188
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* returns a new vector with the sum of a vector and the difference of two vectors
|
|
239
|
+
*/
|
|
240
|
+
static newValues(to: DyFM_Vector2, newV: DyFM_Vector2): DyFM_Vector2 {
|
|
241
|
+
to.x = newV.x;
|
|
242
|
+
to.y = newV.y;
|
|
243
|
+
|
|
244
|
+
return to;
|
|
245
|
+
}
|
|
246
|
+
static readonly newXY = this.newValues;
|
|
189
247
|
|
|
190
248
|
//// AI-ed UNCHECKED
|
|
249
|
+
/**
|
|
250
|
+
* returns the angle between two vectors
|
|
251
|
+
*/
|
|
191
252
|
static angle(from: DyFM_Vector2, to: DyFM_Vector2): number {
|
|
192
253
|
return DyFM_Trigonometry.radiansToAngle(DyFM_Vector2_Util.angleRad(from, to));
|
|
193
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* returns the angle between two vectors in radians
|
|
257
|
+
*/
|
|
194
258
|
static angleRad(from: DyFM_Vector2, to: DyFM_Vector2): number {
|
|
195
259
|
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
196
260
|
}
|
|
197
|
-
|
|
261
|
+
/**
|
|
262
|
+
* returns the angle between two vectors
|
|
263
|
+
*/
|
|
264
|
+
angle(from: DyFM_Vector2, to: DyFM_Vector2): number {
|
|
198
265
|
return DyFM_Vector2_Util.angle(from, to);
|
|
199
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* returns the angle between two vectors in degrees
|
|
269
|
+
*/
|
|
200
270
|
static deg(vector: DyFM_Vector2): number {
|
|
201
271
|
return DyFM_Trigonometry.radiansToAngle(DyFM_Vector2_Util.rad(vector));
|
|
202
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* returns the angle between two vectors in radians
|
|
275
|
+
*/
|
|
203
276
|
static rad(vector: DyFM_Vector2): number {
|
|
204
277
|
return Math.atan2(vector.y, vector.x);
|
|
205
278
|
}
|
|
206
|
-
|
|
279
|
+
/**
|
|
280
|
+
* returns the angle between two vectors in degrees
|
|
281
|
+
*/
|
|
282
|
+
deg(): number {
|
|
207
283
|
return DyFM_Vector2_Util.deg(this);
|
|
208
284
|
}
|
|
209
285
|
|
|
286
|
+
/**
|
|
287
|
+
* returns math floor of the vector
|
|
288
|
+
*/
|
|
210
289
|
static floor(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
211
290
|
return new DyFM_Vector2_Util(Math.floor(v.x), Math.floor(v.y));
|
|
212
291
|
}
|
|
213
|
-
|
|
292
|
+
/**
|
|
293
|
+
* returns math floor of the vector
|
|
294
|
+
*/
|
|
295
|
+
floor(): DyFM_Vector2_Util {
|
|
214
296
|
return DyFM_Vector2_Util.floor(this);
|
|
215
297
|
}
|
|
216
298
|
/////
|
|
217
299
|
|
|
300
|
+
/**
|
|
301
|
+
* returns the direction vector from one point to another
|
|
302
|
+
*/
|
|
218
303
|
static direction(from: DyFM_Vector2, to: DyFM_Vector2): DyFM_Vector2_Util {
|
|
219
304
|
return DyFM_Vector2_Util.minus(to, from);
|
|
220
305
|
}
|
|
221
|
-
|
|
306
|
+
/**
|
|
307
|
+
* returns the direction vector from one point to another
|
|
308
|
+
*/
|
|
309
|
+
direction(to: DyFM_Vector2): DyFM_Vector2_Util {
|
|
222
310
|
return DyFM_Vector2_Util.direction(this, to);
|
|
223
311
|
}
|
|
224
312
|
|
|
313
|
+
/**
|
|
314
|
+
* returns a normalized vector
|
|
315
|
+
*/
|
|
225
316
|
static normalize(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
226
317
|
const v_U = new DyFM_Vector2_Util(v);
|
|
227
318
|
|
|
228
319
|
return v_U.multiply(1 / v_U.magintude);
|
|
229
320
|
}
|
|
230
|
-
|
|
321
|
+
/**
|
|
322
|
+
* returns a normalized vector
|
|
323
|
+
*/
|
|
324
|
+
normalize(): void {
|
|
231
325
|
this.newValues(DyFM_Vector2_Util.normalize(this));
|
|
232
326
|
}
|
|
233
327
|
/**
|
|
234
328
|
* this will return a new instance,
|
|
235
329
|
* if you want to change the current instance, use normalize()
|
|
236
330
|
*/
|
|
237
|
-
normalized
|
|
331
|
+
normalized(): DyFM_Vector2_Util {
|
|
238
332
|
return DyFM_Vector2_Util.normalize(this);
|
|
239
333
|
}
|
|
240
334
|
|
|
241
|
-
|
|
335
|
+
/**
|
|
336
|
+
* returns the magnitude of the vector
|
|
337
|
+
*/
|
|
338
|
+
private calcMagnitude(): void {
|
|
242
339
|
this._magintude = DyFM_Trigonometry.getHypotenuse(this._x, this._y);
|
|
243
340
|
}
|
|
244
341
|
|
|
245
|
-
|
|
342
|
+
/**
|
|
343
|
+
* returns a new vector with the same values
|
|
344
|
+
*/
|
|
345
|
+
clone(): DyFM_Vector2_Util {
|
|
246
346
|
return new DyFM_Vector2_Util(this._x, this._y);
|
|
247
347
|
}
|
|
248
348
|
|
|
349
|
+
/**
|
|
350
|
+
* returns true if the vector has changed
|
|
351
|
+
*/
|
|
249
352
|
static isChanged(a: DyFM_Vector2_Util, b: DyFM_Vector2_Util): boolean {
|
|
250
353
|
return a.x !== b.x || a.y !== b.y;
|
|
251
354
|
}
|
|
252
355
|
|
|
356
|
+
/**
|
|
357
|
+
* returns true if the vectors are equal
|
|
358
|
+
*/
|
|
253
359
|
static isEqual(a: DyFM_Vector2, b: DyFM_Vector2): boolean {
|
|
254
360
|
return a.x === b.x && a.y === b.y;
|
|
255
361
|
}
|
|
256
362
|
|
|
363
|
+
/**
|
|
364
|
+
* returns true if the vectors are equal
|
|
365
|
+
*/
|
|
257
366
|
static vectorChanged(a: DyFM_Vector2, b: DyFM_Vector2): boolean {
|
|
258
367
|
return a.x !== b.x || a.y !== b.y;
|
|
259
368
|
}
|
|
260
369
|
|
|
370
|
+
/**
|
|
371
|
+
* returns true if the vectors are equal
|
|
372
|
+
*/
|
|
261
373
|
static equals(a: DyFM_Vector2, b: DyFM_Vector2): boolean {
|
|
262
374
|
return a.x === b.x && a.y === b.y;
|
|
263
375
|
}
|
|
264
376
|
|
|
377
|
+
/**
|
|
378
|
+
* returns a new vector with the absolute values of the original vector
|
|
379
|
+
*/
|
|
265
380
|
static abs(v: DyFM_Vector2): DyFM_Vector2_Util {
|
|
266
381
|
return new DyFM_Vector2_Util(Math.abs(v.x), Math.abs(v.y));
|
|
267
382
|
}
|
|
268
|
-
abs
|
|
383
|
+
abs(): this {
|
|
269
384
|
return this.newXY(Math.abs(this.x), Math.abs(this.y));
|
|
270
385
|
}
|
|
271
386
|
|
|
387
|
+
/**
|
|
388
|
+
* returns a new vector with the rounded values of the original vector
|
|
389
|
+
*/
|
|
272
390
|
static round(v: DyFM_Vector2, decimals: number = 0): DyFM_Vector2_Util {
|
|
273
391
|
return new DyFM_Vector2_Util(
|
|
274
392
|
DyFM_Math.round(v.x, decimals),
|
|
@@ -276,16 +394,25 @@ export class DyFM_Vector2_Util implements DyFM_Vector2 {
|
|
|
276
394
|
);
|
|
277
395
|
}
|
|
278
396
|
|
|
397
|
+
/**
|
|
398
|
+
* returns a instance of DyFM_Vector2 from a DyFM_Vector2_Util
|
|
399
|
+
*/
|
|
279
400
|
static toVector2(v: DyFM_Vector2_Util): DyFM_Vector2 {
|
|
280
401
|
return (new DyFM_Vector2_Util(v)).get();
|
|
281
402
|
}
|
|
282
403
|
|
|
404
|
+
/**
|
|
405
|
+
* returns a instance of DyFM_Vector2 from a DyFM_Vector2_Util
|
|
406
|
+
*/
|
|
283
407
|
get(): DyFM_Vector2 {
|
|
284
408
|
return { x: this.x, y: this.y };
|
|
285
409
|
}
|
|
286
410
|
getVector2 = this.get;
|
|
287
411
|
toVector2 = this.get;
|
|
288
412
|
|
|
413
|
+
/**
|
|
414
|
+
* returns a new vector with the same values
|
|
415
|
+
*/
|
|
289
416
|
static clone(v: DyFM_Vector2): DyFM_Vector2 {
|
|
290
417
|
return { x: v.x, y: v.y };
|
|
291
418
|
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* This class is a collection of static methods for round list operations
|
|
5
|
+
* A round list is a list that is circular
|
|
6
|
+
* - after the last element, the first comes next
|
|
7
|
+
*/
|
|
5
8
|
export class DyFM_RoundList {
|
|
9
|
+
/**
|
|
10
|
+
* returns the outbound index of the list
|
|
11
|
+
* @param listLength
|
|
12
|
+
* @param outboundIndex
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
6
15
|
static getOutboundedIndex(listLength: number, outboundIndex: number): number {
|
|
7
16
|
if (!listLength) {
|
|
8
17
|
throw new Error('roundListPlusIndex failed. list is empty!');
|
|
@@ -20,6 +29,14 @@ export class DyFM_RoundList {
|
|
|
20
29
|
return outboundIndex;
|
|
21
30
|
}
|
|
22
31
|
|
|
32
|
+
/**
|
|
33
|
+
* returns the index of the opposite element of the list
|
|
34
|
+
* - as they are circular, the opposite is at the half of the list
|
|
35
|
+
* - as it is circular, for the second half, the opposite is at the first half
|
|
36
|
+
* @param length
|
|
37
|
+
* @param oppositeOf
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
23
40
|
static getIndexOpposite(length: number, oppositeOf: number): number {
|
|
24
41
|
const plusIndex = oppositeOf + Math.round(length / 2);
|
|
25
42
|
const res = this.getOutboundedIndex(length, plusIndex);
|
|
@@ -27,15 +44,31 @@ export class DyFM_RoundList {
|
|
|
27
44
|
return res;
|
|
28
45
|
}
|
|
29
46
|
|
|
47
|
+
/**
|
|
48
|
+
* returns the element at the outbound index of the list
|
|
49
|
+
* @param list
|
|
50
|
+
* @param outboundIndex
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
30
53
|
static getListIndex<T>(list: T[], outboundIndex: number): T {
|
|
31
54
|
return list[this.getOutboundedIndex(list.length, outboundIndex)];
|
|
32
55
|
}
|
|
33
56
|
|
|
57
|
+
/**
|
|
58
|
+
* returns the element at the opposite index of the list
|
|
59
|
+
* @param list
|
|
60
|
+
* @param oppositeOf
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
34
63
|
static getListOpposite<T>(list: T[], oppositeOf: T): T {
|
|
35
64
|
return list[this.getIndexOpposite(list.length, list.indexOf(oppositeOf))];
|
|
36
65
|
}
|
|
37
66
|
|
|
38
|
-
|
|
67
|
+
/**
|
|
68
|
+
* returns the last element of the list
|
|
69
|
+
* returns null if the list is empty
|
|
70
|
+
*/
|
|
71
|
+
static getLast<T>(list: T[]): T | null {
|
|
39
72
|
if (0 < list.length) {
|
|
40
73
|
return list[list.length - 1];
|
|
41
74
|
} else {
|
|
@@ -31,10 +31,10 @@ export class DyFM_Shared {
|
|
|
31
31
|
* @returns remapped object list (the final obj will use the deepest keys)
|
|
32
32
|
*/
|
|
33
33
|
static mapObjList(objList: object[], paths: string[][]): object[] {
|
|
34
|
-
let newObjList = [ ...objList ];
|
|
34
|
+
let newObjList: object[] = [ ...objList ];
|
|
35
35
|
|
|
36
36
|
newObjList = newObjList.map((obj): any => {
|
|
37
|
-
const newObj = {};
|
|
37
|
+
const newObj: any = {};
|
|
38
38
|
|
|
39
39
|
paths.forEach((path: string[]): void => {
|
|
40
40
|
newObj[path[path.length - 1]] = this.getNestedData(obj, path);
|
|
@@ -54,7 +54,7 @@ export class DyFM_Shared {
|
|
|
54
54
|
* @returns data from object by path
|
|
55
55
|
*/
|
|
56
56
|
static getNestedData(parentObj: object, nestedDataKeys: string[]): any {
|
|
57
|
-
let newData = DyFM_clone(parentObj); // {...parentObj};
|
|
57
|
+
let newData: any = DyFM_clone(parentObj); // {...parentObj};
|
|
58
58
|
|
|
59
59
|
nestedDataKeys.forEach((dk: string): void => {
|
|
60
60
|
if (newData) {
|
|
@@ -73,11 +73,11 @@ export class DyFM_Shared {
|
|
|
73
73
|
* @returns modified data
|
|
74
74
|
*/
|
|
75
75
|
static nestData(parentObj: object, nestKeys: string[], dataToSet: any): object {
|
|
76
|
-
const newData = DyFM_clone(parentObj); // {...parentObj};
|
|
76
|
+
const newData: any = DyFM_clone(parentObj); // {...parentObj};
|
|
77
77
|
|
|
78
78
|
if (nestKeys.length > 1) {
|
|
79
|
-
const keys = [ ...nestKeys ];
|
|
80
|
-
const nextNestKey = keys.shift();
|
|
79
|
+
const keys: string[] = [ ...nestKeys ];
|
|
80
|
+
const nextNestKey: string = keys.shift() as string;
|
|
81
81
|
|
|
82
82
|
newData[nextNestKey] = this.nestData(newData[nextNestKey], keys, dataToSet);
|
|
83
83
|
} else {
|
|
@@ -95,11 +95,11 @@ export class DyFM_Shared {
|
|
|
95
95
|
* @returns modified data
|
|
96
96
|
*/
|
|
97
97
|
static addToNestedData(parentObj: object, nestKeys: string[], dataToAdd: any): object {
|
|
98
|
-
const newData = DyFM_clone(parentObj); // {...parentObj};
|
|
98
|
+
const newData: any = DyFM_clone(parentObj); // {...parentObj};
|
|
99
99
|
|
|
100
100
|
if (nestKeys.length > 1) {
|
|
101
|
-
const keys = [ ...nestKeys ];
|
|
102
|
-
const nextNestKey = keys.shift();
|
|
101
|
+
const keys: string[] = [ ...nestKeys ];
|
|
102
|
+
const nextNestKey: string = keys.shift() as string;
|
|
103
103
|
|
|
104
104
|
newData[nextNestKey] = this.addToNestedData(newData[nextNestKey], keys, dataToAdd);
|
|
105
105
|
} else {
|
|
@@ -117,11 +117,11 @@ export class DyFM_Shared {
|
|
|
117
117
|
* @returns modified data
|
|
118
118
|
*/
|
|
119
119
|
static pushToNestedData(parentObj: object, nestKeys: string[], dataToPush: any): object {
|
|
120
|
-
const newData = DyFM_clone(parentObj); // {...parentObj};
|
|
120
|
+
const newData: any = DyFM_clone(parentObj); // {...parentObj};
|
|
121
121
|
|
|
122
122
|
if (nestKeys.length > 1) {
|
|
123
|
-
const keys = [ ...nestKeys ];
|
|
124
|
-
const nextNestKey = keys.shift();
|
|
123
|
+
const keys: string[] = [ ...nestKeys ];
|
|
124
|
+
const nextNestKey: string = keys.shift() as string;
|
|
125
125
|
|
|
126
126
|
newData[nextNestKey] = this.pushToNestedData(newData[nextNestKey], keys, dataToPush);
|
|
127
127
|
} else {
|
|
@@ -149,11 +149,11 @@ export class DyFM_Shared {
|
|
|
149
149
|
nestIndexes: number[],
|
|
150
150
|
dataToSet: any
|
|
151
151
|
): T {
|
|
152
|
-
const newData = DyFM_clone(parentObj); // parentObj; // {...parentObj};
|
|
152
|
+
const newData: any = DyFM_clone(parentObj); // parentObj; // {...parentObj};
|
|
153
153
|
|
|
154
154
|
if (nestIndexes.length > 1) {
|
|
155
|
-
const indexes = [ ...nestIndexes ];
|
|
156
|
-
const nextLevelKey = indexes.shift();
|
|
155
|
+
const indexes: number[] = [ ...nestIndexes ];
|
|
156
|
+
const nextLevelKey: number = indexes.shift() as number;
|
|
157
157
|
|
|
158
158
|
newData[nestedListKey][nextLevelKey] = this.nestRecursiveListedData(
|
|
159
159
|
newData[nestedListKey][nextLevelKey], nestedListKey, indexes, dataToSet
|
|
@@ -184,7 +184,7 @@ export class DyFM_Shared {
|
|
|
184
184
|
return 'CIRCULATION:' + location.join('.');
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
let newData;
|
|
187
|
+
let newData: any;
|
|
188
188
|
|
|
189
189
|
if (Array.isArray(data)) {
|
|
190
190
|
newData = [];
|
|
@@ -195,7 +195,7 @@ export class DyFM_Shared {
|
|
|
195
195
|
// using the utility that Object.keys will return array keys if the data is an array
|
|
196
196
|
Object.keys(data).forEach((key: string): void => {
|
|
197
197
|
newData[key] = this.resolveCirculation(
|
|
198
|
-
data[key],
|
|
198
|
+
data[key as keyof typeof data],
|
|
199
199
|
[ ...location, key ],
|
|
200
200
|
[ ...objs, data ]
|
|
201
201
|
);
|
|
@@ -6,33 +6,33 @@ import { DyFM_Log } from './log.util';
|
|
|
6
6
|
* @returns The stack location of the constructor call
|
|
7
7
|
*/
|
|
8
8
|
export function DyFM_getStackLocation(): string {
|
|
9
|
-
let stack: string = new Error().stack;
|
|
9
|
+
let stack: string = new Error().stack as string;
|
|
10
10
|
|
|
11
11
|
// Split the stack into lines and remove the first line (Error:)
|
|
12
12
|
const stackLines = stack?.split('\n')?.slice(1);
|
|
13
13
|
|
|
14
14
|
// Find the line that contains the constructor call
|
|
15
15
|
// It will be the FIRST line that doesn't contain 'getStackLocation'
|
|
16
|
-
let constructorLine = stackLines?.find(line =>
|
|
16
|
+
let constructorLine: string | undefined = stackLines?.find(line =>
|
|
17
17
|
!line.includes('getStackLocation') &&
|
|
18
18
|
!line.includes('at new')
|
|
19
19
|
);
|
|
20
20
|
if (!constructorLine) {
|
|
21
|
-
let constructorLine = stack?.split(' at ')?.find(line =>
|
|
21
|
+
let constructorLine: string | undefined = stack?.split(' at ')?.find(line =>
|
|
22
22
|
!line.includes('getStackLocation') &&
|
|
23
23
|
!line.includes('at new')
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
if (!constructorLine) {
|
|
27
|
-
DyFM_Log.warn(`No constructor line found\n${typeof stack}\n${stack?.slice(0,
|
|
27
|
+
DyFM_Log.warn(`No constructor line found\n${typeof stack}\n${stack?.slice(0, 200)?.split('\n') + '...'}`);
|
|
28
28
|
return '';
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Remove the 'constructorLine at ... (' and the ')'
|
|
33
|
-
constructorLine = constructorLine
|
|
33
|
+
constructorLine = constructorLine?.split('(')[1]?.split(')')[0];
|
|
34
34
|
if (!constructorLine) {
|
|
35
|
-
DyFM_Log.warn(`No constructor line found\n${typeof stack}\n${stack?.slice(0,
|
|
35
|
+
DyFM_Log.warn(`No constructor line found\n${typeof stack}\n${stack?.slice(0, 200)?.split('\n') + '...'}`);
|
|
36
36
|
return '';
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* String utility class
|
|
6
|
+
*/
|
|
4
7
|
export class DyFM_String {
|
|
5
8
|
|
|
6
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Removes \n, \r and spaces from the start and end of the string
|
|
11
|
+
* @param value - The string to trim
|
|
12
|
+
* @returns The trimmed string
|
|
13
|
+
*/
|
|
7
14
|
static breakTrim(value: string): string {
|
|
8
15
|
return value.trim().replace(/(\r\n|\n|\r)/gm, '');
|
|
9
16
|
}
|
|
@@ -6,16 +6,51 @@ import { DyFM_RelativeDate } from '../../_enums/time/relative-date.enum';
|
|
|
6
6
|
import { DyFM_Math } from './math/math.util';
|
|
7
7
|
|
|
8
8
|
export type DyFM_T = DyFM_Time;
|
|
9
|
+
/**
|
|
10
|
+
* Time utility class
|
|
11
|
+
*/
|
|
9
12
|
export class DyFM_Time {
|
|
10
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The number of milliseconds in a second
|
|
16
|
+
*/
|
|
11
17
|
static readonly second = second;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The number of milliseconds in a minute
|
|
21
|
+
*/
|
|
12
22
|
static readonly minute = minute;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The number of milliseconds in an hour
|
|
26
|
+
*/
|
|
13
27
|
static readonly hour = hour;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The number of milliseconds in a day
|
|
31
|
+
*/
|
|
14
32
|
static readonly day = day;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The number of milliseconds in a week
|
|
36
|
+
*/
|
|
15
37
|
static readonly week = week;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The number of milliseconds in a month
|
|
41
|
+
*/
|
|
16
42
|
static readonly month = month;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The number of milliseconds in a year
|
|
46
|
+
*/
|
|
17
47
|
static readonly year = year;
|
|
18
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Get the age of a person
|
|
51
|
+
* @param birthDate - The birth date of the person
|
|
52
|
+
* @returns The age of the person
|
|
53
|
+
*/
|
|
19
54
|
static getAge(birthDate: Date | number | string): number {
|
|
20
55
|
return this.getYear(+new Date() - +new Date(birthDate));
|
|
21
56
|
}
|
|
@@ -143,7 +178,7 @@ export class DyFM_Time {
|
|
|
143
178
|
*/
|
|
144
179
|
static getTodayOfWeek(): DyFM_DayOfWeek {
|
|
145
180
|
return DyFM_DayOfWeek[
|
|
146
|
-
new Date().toLocaleString('en-us', { weekday: 'long' }).toLocaleLowerCase()
|
|
181
|
+
new Date().toLocaleString('en-us', { weekday: 'long' }).toLocaleLowerCase() as keyof typeof DyFM_DayOfWeek
|
|
147
182
|
];
|
|
148
183
|
}
|
|
149
184
|
|
|
@@ -177,7 +212,7 @@ export class DyFM_Time {
|
|
|
177
212
|
*/
|
|
178
213
|
static getCurrentMonth(): DyFM_Month {
|
|
179
214
|
return DyFM_Month[
|
|
180
|
-
new Date().toLocaleString('en-us', { month: 'long' }).toLocaleLowerCase()
|
|
215
|
+
new Date().toLocaleString('en-us', { month: 'long' }).toLocaleLowerCase() as keyof typeof DyFM_Month
|
|
181
216
|
];
|
|
182
217
|
}
|
|
183
218
|
|