@futdevpro/fsm-dynamo 1.14.9 → 1.14.11
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/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 +40 -0
- 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 +195 -5
- 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 +36 -0
- 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 +48 -14
- 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 +247 -19
- package/build/_collections/utils/math/vector2.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 +19 -0
- package/build/_collections/utils/stack.util.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 +136 -0
- 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 -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 +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 +8 -0
- package/build/_models/control-models/data-property-params.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 +25 -0
- 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 +8 -0
- 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 +9 -0
- 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 +18 -0
- 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 +141 -0
- 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 -0
- 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 +12 -0
- 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 +12 -0
- 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 +10 -0
- 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 -0
- package/build/_models/data-models/metadata.data-model.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 +23 -0
- package/build/_modules/ci-tools/_models/cit-ci-result-info.data-models.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 -0
- package/build/_modules/custom-data/_models/cud.data-model.js.map +1 -1
- 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 +33 -0
- 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/futdevpro-fsm-dynamo-01.14.11.tgz +0 -0
- package/package.json +1 -1
- 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 +38 -0
- 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 +19 -0
- 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 +12 -0
- 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/ci-tools/_models/cit-ci-result-info.data-models.ts +23 -0
- package/src/_modules/custom-data/_models/cud.data-model.ts +7 -0
- package/src/_modules/location/_collections/loc-regions.util.ts +34 -1
- package/src/_modules/location/_collections/loc.util.ts +10 -0
- package/futdevpro-fsm-dynamo-01.14.9.tgz +0 -0
|
@@ -42,6 +42,17 @@ class DyFM_Regions {
|
|
|
42
42
|
});
|
|
43
43
|
return result;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Converts an ISO-3166 code to a country ISO object.
|
|
47
|
+
* @param iso2 The ISO-3166 code to convert.
|
|
48
|
+
* @returns The country ISO object.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const country: DyFM_CountryISO = DyFM_Regions.isoToCountryIso('US');
|
|
53
|
+
* console.log(country.name); // United States
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
45
56
|
static isoToCountryIso(iso2) {
|
|
46
57
|
const country = this.countryISOs.find((iso) => iso.iso2 == iso2);
|
|
47
58
|
if (!country) {
|
|
@@ -53,6 +64,17 @@ class DyFM_Regions {
|
|
|
53
64
|
return country;
|
|
54
65
|
}
|
|
55
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Converts an ISO-3166 code to a region.
|
|
69
|
+
* @param iso2 The ISO-3166 code to convert.
|
|
70
|
+
* @returns The region.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const region: DyFM_Region = DyFM_Regions.isoToRegion('US');
|
|
75
|
+
* console.log(region); // North America
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
56
78
|
static isoToRegion(iso2) {
|
|
57
79
|
const region = this.countryISOs.find((iso) => iso.iso2 == iso2)?.region;
|
|
58
80
|
if (!region) {
|
|
@@ -64,6 +86,17 @@ class DyFM_Regions {
|
|
|
64
86
|
return region;
|
|
65
87
|
}
|
|
66
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Converts an ISO-3166 code to a phone code.
|
|
91
|
+
* @param iso2 The ISO-3166 code to convert.
|
|
92
|
+
* @returns The phone code.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const phoneCode: DyFM_CountryPhoneCode = DyFM_Regions.isoToPhoneCode('US');
|
|
97
|
+
* console.log(phoneCode.code); // +1
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
67
100
|
static isoToPhoneCode(iso2) {
|
|
68
101
|
const phoneCode = this.phoneCodes.find((code) => code.iso == iso2);
|
|
69
102
|
if (!phoneCode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loc-regions.util.js","sourceRoot":"","sources":["../../../../src/_modules/location/_collections/loc-regions.util.ts"],"names":[],"mappings":";;;;AACA;;wBAEwB;AACxB,mFAA6D;AAE7D,sFAAgE;AAChE,qGAA+E;AAS/E,yEAAsE;AACtE,6FAAiF;AAGjF;;;GAGG;AACH,MAAa,YAAY;IACvB,qFAAqF;IACrF,MAAM,CAAU,SAAS,GAA2B,YAAY,CAAC,eAAe,EAAE,CAAC;IACnF,MAAM,CAAU,UAAU,GAA4B,YAAY,CAAC,gBAAgB,EAAE,CAAC;IACtF,MAAM,CAAU,WAAW,GAAsB,YAAY,CAAC,gBAAgB,EAAE,CAAC;IAEzE,MAAM,CAAC,eAAe;QAC5B,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,gCAAU,CAAC,EAAE,OAAO,EAAE,iCAA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;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAY;QAC7B,MAAM,MAAM,GAAgB,IAAI,CAAC,WAAW,CAAC,IAAI,CAC/C,CAAC,GAAoB,EAAW,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CACpD,EAAE,MAAM,CAAC;QAEV,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,gCAAU,CAAC;gBACnB,OAAO,EAAE,uCAAuC,IAAI,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,IAAY;QAChC,MAAM,SAAS,GAA0B,IAAI,CAAC,UAAU,CAAC,IAAI,CAC3D,CAAC,IAA2B,EAAW,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAC3D,CAAC;QAEF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,gCAAU,CAAC;gBACnB,OAAO,EAAE,uCAAuC,IAAI,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;;
|
|
1
|
+
{"version":3,"file":"loc-regions.util.js","sourceRoot":"","sources":["../../../../src/_modules/location/_collections/loc-regions.util.ts"],"names":[],"mappings":";;;;AACA;;wBAEwB;AACxB,mFAA6D;AAE7D,sFAAgE;AAChE,qGAA+E;AAS/E,yEAAsE;AACtE,6FAAiF;AAGjF;;;GAGG;AACH,MAAa,YAAY;IACvB,qFAAqF;IACrF,MAAM,CAAU,SAAS,GAA2B,YAAY,CAAC,eAAe,EAAE,CAAC;IACnF,MAAM,CAAU,UAAU,GAA4B,YAAY,CAAC,gBAAgB,EAAE,CAAC;IACtF,MAAM,CAAU,WAAW,GAAsB,YAAY,CAAC,gBAAgB,EAAE,CAAC;I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AI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,gCAAU,CAAC;gBACnB,OAAO,EAAE,uCAAuC,IAAI,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,WAAW,CAAC,IAAY;QAC7B,MAAM,MAAM,GAAgB,IAAI,CAAC,WAAW,CAAC,IAAI,CAC/C,CAAC,GAAoB,EAAW,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CACpD,EAAE,MAAM,CAAC;QAEV,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,gCAAU,CAAC;gBACnB,OAAO,EAAE,uCAAuC,IAAI,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,cAAc,CAAC,IAAY;QAChC,MAAM,SAAS,GAA0B,IAAI,CAAC,UAAU,CAAC,IAAI,CAC3D,CAAC,IAA2B,EAAW,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAC3D,CAAC;QAEF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,gCAAU,CAAC;gBACnB,OAAO,EAAE,uCAAuC,IAAI,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;;AA9GH,oCA+GC"}
|
|
@@ -9,6 +9,16 @@ export declare class DyFM_Location {
|
|
|
9
9
|
static getDistanceInKilometres(from: DyFM_LocationCoordinates, to: DyFM_LocationCoordinates): number;
|
|
10
10
|
/**
|
|
11
11
|
* Converts a distance in kilometers to degree difference for latitude or longitude.
|
|
12
|
+
* @param latiOrLong The direction to convert to degrees.
|
|
13
|
+
* @param distanceInKm The distance in kilometers.
|
|
14
|
+
* @param latitude The latitude to use for the conversion.
|
|
15
|
+
* @returns The degree difference.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const degreeChange = DyFM_Location.getLocationDegByKilometers('latitude', 110.574);
|
|
20
|
+
* console.log(degreeChange); // 1
|
|
21
|
+
* ```
|
|
12
22
|
*/
|
|
13
23
|
static getLocationDegByKilometers(latiOrLong: 'latitude' | 'longitude', distanceInKm: number, latitude?: number): number;
|
|
14
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loc.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/location/_collections/loc.util.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAC5B,IAAI,EAAE,wBAAwB,EAC9B,EAAE,EAAE,wBAAwB,GAC3B,MAAM;IAgBT
|
|
1
|
+
{"version":3,"file":"loc.util.d.ts","sourceRoot":"","sources":["../../../../src/_modules/location/_collections/loc.util.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAC5B,IAAI,EAAE,wBAAwB,EAC9B,EAAE,EAAE,wBAAwB,GAC3B,MAAM;IAgBT;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,0BAA0B,CAC/B,UAAU,EAAE,UAAU,GAAG,WAAW,EACpC,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM;CAqBV"}
|
|
@@ -24,6 +24,16 @@ class DyFM_Location {
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Converts a distance in kilometers to degree difference for latitude or longitude.
|
|
27
|
+
* @param latiOrLong The direction to convert to degrees.
|
|
28
|
+
* @param distanceInKm The distance in kilometers.
|
|
29
|
+
* @param latitude The latitude to use for the conversion.
|
|
30
|
+
* @returns The degree difference.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const degreeChange = DyFM_Location.getLocationDegByKilometers('latitude', 110.574);
|
|
35
|
+
* console.log(degreeChange); // 1
|
|
36
|
+
* ```
|
|
27
37
|
*/
|
|
28
38
|
static getLocationDegByKilometers(latiOrLong, distanceInKm, latitude) {
|
|
29
39
|
if (latiOrLong === 'latitude') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loc.util.js","sourceRoot":"","sources":["../../../../src/_modules/location/_collections/loc.util.ts"],"names":[],"mappings":";;;AACA,6FAAiF;AACjF,0FAAuF;AAKvF;;GAEG;AACH,MAAa,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAC5B,IAA8B,EAC9B,EAA4B;QAG5B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,aAAa;QAC7B,MAAM,EAAE,GAAG,qCAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3D,MAAM,EAAE,GAAG,qCAAiB,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,EAAE,GAAG,qCAAiB,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzE,MAAM,EAAE,GAAG,qCAAiB,CAAC,cAAc,CAAC,EAAE,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3E,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,C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AE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEzD,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,0BAA0B,CAC/B,UAAoC,EACpC,YAAoB,EACpB,QAAiB;QAEjB,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;YAC9B,OAAO,YAAY,GAAG,OAAO,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,YAAY,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,qCAAiB,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;YACzF,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,gCAAU,CAAC;oBACnB,MAAM,EAAE,GAAG;oBACX,SAAS,EAAE,aAAa;oBACxB,cAAc,EAAE,IAAI;oBACpB,OAAO,EACL,kFAAkF;wBAClF,gBAAgB,UAAU,mBAAmB,YAAY,eAAe,QAAQ,GAAG;oBACrF,WAAW,EACT,4CAA4C;wBAC5C,kDAAkD;iBACrD,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA7DD,sCA6DC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/fsm-dynamo",
|
|
3
|
-
"version": "01.14.
|
|
3
|
+
"version": "01.14.11",
|
|
4
4
|
"description": "Full Stack Model Collection for Dynamic (NodeJS-Typescript) Framework called Dynamo, by Future Development Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "full-stack-package",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
//file méret számításoknál a byte a legkisebb egység amit használunk
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* One byte is
|
|
6
|
+
* One byte is 8 bits
|
|
7
7
|
*/
|
|
8
|
-
export const byte =
|
|
8
|
+
export const byte = 8;
|
|
9
9
|
/**
|
|
10
10
|
* One kilobyte is 1024 bytes
|
|
11
11
|
*/
|
|
12
|
-
export const kilobyte =
|
|
12
|
+
export const kilobyte = 1024;
|
|
13
13
|
/**
|
|
14
14
|
* One megabyte is 1024 kilobytes
|
|
15
15
|
*/
|
|
@@ -16,6 +16,14 @@ export class DyFM_Array {
|
|
|
16
16
|
* @param list - The array to iterate over.
|
|
17
17
|
* @param func - The function to apply to each element.
|
|
18
18
|
* @returns A promise that resolves when all elements have been processed.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
23
|
+
* await DyFM_Array.asyncForEach(list, async (element: number, index?: number, array?: number[]): Promise<void> => {
|
|
24
|
+
* console.log(element, index, array);
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
19
27
|
*/
|
|
20
28
|
static async asyncForEach<T>(
|
|
21
29
|
list: T[],
|
|
@@ -32,6 +40,14 @@ export class DyFM_Array {
|
|
|
32
40
|
* @param list - The array to iterate over.
|
|
33
41
|
* @param func - The function to apply to each element.
|
|
34
42
|
* @returns A promise that resolves to the final result.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
47
|
+
* const result = await DyFM_Array.asyncForEachReturnToOne(0, list, async (element: number, dataCurrent: number, index?: number, array?: number[]): Promise<number> => {
|
|
48
|
+
* return dataCurrent + element;
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
35
51
|
*/
|
|
36
52
|
static async asyncForEachReturnToOne<T, K>(
|
|
37
53
|
startData: K,
|
|
@@ -52,6 +68,14 @@ export class DyFM_Array {
|
|
|
52
68
|
* @param list - The array to iterate over.
|
|
53
69
|
* @param func - The function to apply to each element.
|
|
54
70
|
* @returns A promise that resolves to an array of results.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
75
|
+
* const result = await DyFM_Array.asyncForEachReturnToAll(list, async (element: number, index?: number, array?: number[]): Promise<number> => {
|
|
76
|
+
* return element * 2;
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
55
79
|
*/
|
|
56
80
|
static async asyncForEachReturnToAll<T, K>(
|
|
57
81
|
list: T[],
|
|
@@ -71,6 +95,15 @@ export class DyFM_Array {
|
|
|
71
95
|
* @param list - The array to iterate over.
|
|
72
96
|
* @param func - The function to apply to each element.
|
|
73
97
|
* @returns A promise that resolves to an array of results.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
102
|
+
* const result = await DyFM_Array.asyncForEachAllAtOnce(list, async (element: number, index?: number, array?: number[]): Promise<number> => {
|
|
103
|
+
* return [ element * 2, element * 3 ];
|
|
104
|
+
* });
|
|
105
|
+
* console.log(result); // [ [ 2, 3 ], [ 4, 6 ], [ 6, 9 ] ]
|
|
106
|
+
* ```
|
|
74
107
|
*/
|
|
75
108
|
static async asyncForEachAllAtOnce<T, R>(
|
|
76
109
|
list: T[],
|
|
@@ -84,6 +117,15 @@ export class DyFM_Array {
|
|
|
84
117
|
* @param list - The array to filter.
|
|
85
118
|
* @param filterFunc - The function to apply to each element.
|
|
86
119
|
* @returns A promise that resolves to an array of results.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
124
|
+
* const result = await DyFM_Array.asyncFilter(list, async (element: number, index?: number, array?: number[]): Promise<boolean> => {
|
|
125
|
+
* return element % 2 === 0;
|
|
126
|
+
* });
|
|
127
|
+
* console.log(result); // [ 2 ]
|
|
128
|
+
* ```
|
|
87
129
|
*/
|
|
88
130
|
static async asyncFilter<T>(
|
|
89
131
|
list: T[],
|
|
@@ -105,6 +147,15 @@ export class DyFM_Array {
|
|
|
105
147
|
* @param list - The array to map.
|
|
106
148
|
* @param mapFunc - The function to apply to each element.
|
|
107
149
|
* @returns A promise that resolves to an array of results.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
154
|
+
* const result = await DyFM_Array.asyncMap(list, async (element: number, index?: number, array?: number[]): Promise<number> => {
|
|
155
|
+
* return element * 2;
|
|
156
|
+
* });
|
|
157
|
+
* console.log(result); // [ 2, 4, 6 ]
|
|
158
|
+
* ```
|
|
108
159
|
*/
|
|
109
160
|
static async asyncMap<T, R>(
|
|
110
161
|
list: T[],
|
|
@@ -123,6 +174,13 @@ export class DyFM_Array {
|
|
|
123
174
|
* Returns the last element of an array.
|
|
124
175
|
* @param array - The array to get the last element from.
|
|
125
176
|
* @returns The last element of the array, or null if the array is empty.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
181
|
+
* const result = DyFM_Array.last(list);
|
|
182
|
+
* console.log(result); // 3
|
|
183
|
+
* ```
|
|
126
184
|
*/
|
|
127
185
|
static last<T>(array: T[]): T | null {
|
|
128
186
|
return array?.length ? array[array.length - 1] : null;
|
|
@@ -133,6 +191,13 @@ export class DyFM_Array {
|
|
|
133
191
|
* @param string - The string to check.
|
|
134
192
|
* @param array - The array to check.
|
|
135
193
|
* @returns True if the string is the last element of the array, false otherwise.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
198
|
+
* const result = DyFM_Array.isLast(3, list);
|
|
199
|
+
* console.log(result); // true
|
|
200
|
+
* ```
|
|
136
201
|
*/
|
|
137
202
|
static isLast<T>(element: T, array: T[]): boolean {
|
|
138
203
|
return array.indexOf(element) === array.length - 1;
|
|
@@ -143,6 +208,13 @@ export class DyFM_Array {
|
|
|
143
208
|
* @param string - The string to check.
|
|
144
209
|
* @param array - The array to check.
|
|
145
210
|
* @returns True if the string is the last element of the array, false otherwise.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
215
|
+
* const result = DyFM_Array.isLastIndex(2, list);
|
|
216
|
+
* console.log(result); // true
|
|
217
|
+
* ```
|
|
146
218
|
*/
|
|
147
219
|
static isLastIndex<T>(index: number, array: T[]): boolean {
|
|
148
220
|
return index === array.length - 1;
|
|
@@ -153,6 +225,13 @@ export class DyFM_Array {
|
|
|
153
225
|
* @param string - The string to check.
|
|
154
226
|
* @param array - The array to check.
|
|
155
227
|
* @returns True if the string is the first element of the array, false otherwise.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
232
|
+
* const result = DyFM_Array.isFirst(1, list);
|
|
233
|
+
* console.log(result); // true
|
|
234
|
+
* ```
|
|
156
235
|
*/
|
|
157
236
|
static isFirst<T>(element: T, array: T[]): boolean {
|
|
158
237
|
return array.indexOf(element) === 0;
|
|
@@ -162,6 +241,13 @@ export class DyFM_Array {
|
|
|
162
241
|
* Returns the last character of a string.
|
|
163
242
|
* @param string - The string to get the last character from.
|
|
164
243
|
* @returns The last character of the string, or null if the string is empty.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const string = 'hello';
|
|
248
|
+
* const result = DyFM_Array.lastCharacter(string);
|
|
249
|
+
* console.log(result); // 'o'
|
|
250
|
+
* ```
|
|
165
251
|
*/
|
|
166
252
|
static lastCharacter(string: string): string | null {
|
|
167
253
|
return string?.length ? string[string.length - 1] : null;
|
|
@@ -171,6 +257,13 @@ export class DyFM_Array {
|
|
|
171
257
|
* Returns the first element of an array.
|
|
172
258
|
* @param array - The array to get the first element from.
|
|
173
259
|
* @returns The first element of the array, or null if the array is empty.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
264
|
+
* const result = DyFM_Array.first(list);
|
|
265
|
+
* console.log(result); // 1
|
|
266
|
+
* ```
|
|
174
267
|
*/
|
|
175
268
|
static first<T>(array: T[]): T | null {
|
|
176
269
|
return array?.length ? array[0] : null;
|
|
@@ -181,6 +274,13 @@ export class DyFM_Array {
|
|
|
181
274
|
* @param array - The array to remove the element from.
|
|
182
275
|
* @param element - The element to remove from the array.
|
|
183
276
|
* @returns The array with the element removed.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
281
|
+
* const result = DyFM_Array.remove(list, 2);
|
|
282
|
+
* console.log(result); // [ 1, 3 ]
|
|
283
|
+
* ```
|
|
184
284
|
*/
|
|
185
285
|
static remove<T>(array: T[], element: T): T[] {
|
|
186
286
|
const index = array.indexOf(element);
|
|
@@ -197,6 +297,15 @@ export class DyFM_Array {
|
|
|
197
297
|
* @param array - The array to find and remove the element from.
|
|
198
298
|
* @param func - The function to apply to each element.
|
|
199
299
|
* @returns The array with the element removed.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```ts
|
|
303
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
304
|
+
* const result = DyFM_Array.findNRemove(list, (element: number, index?: number, array?: number[]): boolean => {
|
|
305
|
+
* return element === 2;
|
|
306
|
+
* });
|
|
307
|
+
* console.log(result); // [ 1, 3 ]
|
|
308
|
+
* ```
|
|
200
309
|
*/
|
|
201
310
|
static findNRemove<T>(
|
|
202
311
|
array: T[],
|
|
@@ -215,6 +324,13 @@ export class DyFM_Array {
|
|
|
215
324
|
* Shuffles an array.
|
|
216
325
|
* @param array - The array to shuffle.
|
|
217
326
|
* @returns The shuffled array.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
331
|
+
* const result = DyFM_Array.shuffle(list);
|
|
332
|
+
* console.log(result); // [ 3, 1, 2 ]
|
|
333
|
+
* ```
|
|
218
334
|
*/
|
|
219
335
|
static shuffle<T>(array: T[]): T[] {
|
|
220
336
|
let currentIndex = array.length;
|
|
@@ -236,6 +352,13 @@ export class DyFM_Array {
|
|
|
236
352
|
* @param pageIndex - The index of the page to return.
|
|
237
353
|
* @param pageSize - The size of the page.
|
|
238
354
|
* @returns The page of the array.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* const list: number[] = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
|
|
359
|
+
* const result = DyFM_Array.page(list, 0, 2);
|
|
360
|
+
* console.log(result); // [ 1, 2 ]
|
|
361
|
+
* ```
|
|
239
362
|
*/
|
|
240
363
|
static page<T>(array: T[], pageIndex: number, pageSize: number): T[] {
|
|
241
364
|
return array.slice(pageIndex * pageSize, (pageIndex + 1) * pageSize);
|
|
@@ -247,6 +370,13 @@ export class DyFM_Array {
|
|
|
247
370
|
* @param pageIndex - The index of the page to return.
|
|
248
371
|
* @param pageSize - The size of the page.
|
|
249
372
|
* @returns The page of the array.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* const list: number[] = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
|
|
377
|
+
* const result = DyFM_Array.paged(list, 0, 2);
|
|
378
|
+
* console.log(result); // { pageIndex: 0, pageSize: 2, total: 8, totalPageCount: 4, items: [ 1, 2 ] }
|
|
379
|
+
* ```
|
|
250
380
|
*/
|
|
251
381
|
static paged<T>(array: T[], pageIndex: number, pageSize: number): DyFM_Paged<T> {
|
|
252
382
|
return {
|
|
@@ -264,6 +394,13 @@ export class DyFM_Array {
|
|
|
264
394
|
* @param indexA - The index of the first element to swap.
|
|
265
395
|
* @param indexB - The index of the second element to swap.
|
|
266
396
|
* @returns The array with the elements swapped.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```ts
|
|
400
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
401
|
+
* const result = DyFM_Array.swap(list, 0, 2);
|
|
402
|
+
* console.log(result); // [ 3, 2, 1 ]
|
|
403
|
+
* ```
|
|
267
404
|
*/
|
|
268
405
|
static swap<T>(array: T[], indexA: number, indexB: number): T[] {
|
|
269
406
|
[ array[indexA], array[indexB] ] = [ array[indexB], array[indexA] ];
|
|
@@ -275,6 +412,13 @@ export class DyFM_Array {
|
|
|
275
412
|
* Checks if a string list has multiplications.
|
|
276
413
|
* @param stringList - The string list to check.
|
|
277
414
|
* @returns True if the string list has multiplications, false otherwise.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```ts
|
|
418
|
+
* const list: string[] = [ 'a', 'b', 'c', 'a' ];
|
|
419
|
+
* const result = DyFM_Array.stringListHasMultiplications(list);
|
|
420
|
+
* console.log(result); // true
|
|
421
|
+
* ```
|
|
278
422
|
*/
|
|
279
423
|
static stringListHasMultiplications(stringList: string[]): boolean {
|
|
280
424
|
return stringList.some((str: string, index: number): boolean => {
|
|
@@ -286,6 +430,13 @@ export class DyFM_Array {
|
|
|
286
430
|
* Filters a string list to remove multiplications.
|
|
287
431
|
* @param stringList - The string list to filter.
|
|
288
432
|
* @returns The filtered string list.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```ts
|
|
436
|
+
* const list: string[] = [ 'a', 'b', 'c', 'a' ];
|
|
437
|
+
* const result = DyFM_Array.filterStringMultiplications(list);
|
|
438
|
+
* console.log(result); // [ 'a', 'b', 'c' ]
|
|
439
|
+
* ```
|
|
289
440
|
*/
|
|
290
441
|
static filterStringMultiplications(stringList: string[]): string[] {
|
|
291
442
|
return stringList.filter((str: string, index: number): boolean => {
|
|
@@ -297,6 +448,13 @@ export class DyFM_Array {
|
|
|
297
448
|
* Gathers multiplications from a string list.
|
|
298
449
|
* @param stringList - The string list to gather multiplications from.
|
|
299
450
|
* @returns The gathered multiplications.
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```ts
|
|
454
|
+
* const list: string[] = [ 'a', 'b', 'c', 'a' ];
|
|
455
|
+
* const result = DyFM_Array.gatherStringMultiplications(list);
|
|
456
|
+
* console.log(result); // [ [ 'a', 'a' ] ]
|
|
457
|
+
* ```
|
|
300
458
|
*/
|
|
301
459
|
static gatherStringMultiplications(stringList: string[]): string[][] {
|
|
302
460
|
const multiplications: string[][] = [];
|
|
@@ -323,6 +481,13 @@ export class DyFM_Array {
|
|
|
323
481
|
* @param dataList - The data list to check.
|
|
324
482
|
* @param byKey - The key to check for multiplications.
|
|
325
483
|
* @returns True if the data list has multiplications, false otherwise.
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```ts
|
|
487
|
+
* const list: { _id: number, name: string }[] = [ { _id: 1, name: 'John' }, { _id: 2, name: 'Jane' }, { _id: 1, name: 'Bob' } ];
|
|
488
|
+
* const result = DyFM_Array.haveMultiplications(list, '_id');
|
|
489
|
+
* console.log(result); // true
|
|
490
|
+
* ```
|
|
326
491
|
*/
|
|
327
492
|
static haveMultiplications<T extends object>(dataList: T[], byKey: keyof T = '_id' as keyof T): boolean {
|
|
328
493
|
return dataList.some((data: T, index: number): boolean => {
|
|
@@ -337,6 +502,13 @@ export class DyFM_Array {
|
|
|
337
502
|
* @param dataList - The data list to filter.
|
|
338
503
|
* @param byKey - The key to filter for multiplications.
|
|
339
504
|
* @returns The filtered data list.
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```ts
|
|
508
|
+
* const list: { _id: number, name: string }[] = [ { _id: 1, name: 'John' }, { _id: 2, name: 'Jane' }, { _id: 1, name: 'Bob' } ];
|
|
509
|
+
* const result = DyFM_Array.filterMultiplications(list, '_id');
|
|
510
|
+
* console.log(result); // [ { _id: 1, name: 'John' } , { _id: 2, name: 'Jane' } ]
|
|
511
|
+
* ```
|
|
340
512
|
*/
|
|
341
513
|
static filterMultiplications<T extends object>(dataList: T[], byKey: keyof T = '_id' as keyof T): T[] {
|
|
342
514
|
return dataList.filter((data: T, index: number): boolean => {
|
|
@@ -351,6 +523,13 @@ export class DyFM_Array {
|
|
|
351
523
|
* @param dataList - The data list to gather multiplications from.
|
|
352
524
|
* @param byKey - The key to gather multiplications from.
|
|
353
525
|
* @returns The gathered multiplications.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```ts
|
|
529
|
+
* const list: { _id: number, name: string }[] = [ { _id: 1, name: 'John' }, { _id: 2, name: 'Jane' }, { _id: 1, name: 'Bob' } ];
|
|
530
|
+
* const result = DyFM_Array.gatherMultiplications(list, '_id');
|
|
531
|
+
* console.log(result); // [ [ { _id: 1, name: 'John' }, { _id: 1, name: 'Bob' } ] ]
|
|
532
|
+
* ```
|
|
354
533
|
*/
|
|
355
534
|
static gatherMultiplications<T extends object>(dataList: T[], byKey: keyof T = '_id' as keyof T): T[][] {
|
|
356
535
|
const multiplications: T[][] = [];
|
|
@@ -375,6 +554,15 @@ export class DyFM_Array {
|
|
|
375
554
|
* @param array - The array to find the element in.
|
|
376
555
|
* @param func - The function to apply to each element.
|
|
377
556
|
* @returns The element found, or null if no element is found.
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```ts
|
|
560
|
+
* const list: number[] = [ 1, 2, 3 ];
|
|
561
|
+
* const result = DyFM_Array.findFromEnd(list, (element: number, index?: number, array?: number[]): boolean => {
|
|
562
|
+
* return element === 2;
|
|
563
|
+
* });
|
|
564
|
+
* console.log(result); // 2
|
|
565
|
+
* ```
|
|
378
566
|
*/
|
|
379
567
|
static findFromEnd<T>(
|
|
380
568
|
array: T[],
|
|
@@ -395,6 +583,7 @@ export class DyFM_Array {
|
|
|
395
583
|
* sorts so that the objects that have the value true for the checkFor function are at the beginning of the array
|
|
396
584
|
* @param checkFor
|
|
397
585
|
* @returns
|
|
586
|
+
*
|
|
398
587
|
*/
|
|
399
588
|
static getSortForTrueFn<T>(
|
|
400
589
|
checkFor: (a: T) => boolean
|
|
@@ -10,6 +10,11 @@ export class DyFM_Async {
|
|
|
10
10
|
* delays the execution of a function
|
|
11
11
|
* @param ms
|
|
12
12
|
* @returns
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* await DyFM_Async.wait(1000);
|
|
17
|
+
* ```
|
|
13
18
|
*/
|
|
14
19
|
static wait(ms: number): Promise<void> {
|
|
15
20
|
return new Promise((resolve): any => setTimeout(resolve, ms));
|
|
@@ -20,6 +25,11 @@ export class DyFM_Async {
|
|
|
20
25
|
/**
|
|
21
26
|
* WARNING: This function is recommended to use ONLY for limited instances,
|
|
22
27
|
* because it can cause performance issues.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* await DyFM_Async.waitUntil(() => check(), 100, 10000);
|
|
32
|
+
* ```
|
|
23
33
|
*/
|
|
24
34
|
static waitUntil(
|
|
25
35
|
check: () => boolean,
|
|
@@ -80,6 +90,14 @@ export class DyFM_Async {
|
|
|
80
90
|
|
|
81
91
|
/**
|
|
82
92
|
* Creates a promise that resolves when the observable emits a value that passes the check function
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const observable = new Observable<number>(observer => {
|
|
97
|
+
* setInterval(() => observer.next(Math.random()), 100);
|
|
98
|
+
* });
|
|
99
|
+
* const result = await DyFM_Async.takeUntil(observable, (value?: number) => value && value > 0.5);
|
|
100
|
+
* ```
|
|
83
101
|
*/
|
|
84
102
|
static takeUntil<T>(
|
|
85
103
|
observable: Observable<T>,
|
|
@@ -97,6 +115,17 @@ export class DyFM_Async {
|
|
|
97
115
|
});
|
|
98
116
|
}
|
|
99
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Waits for a given amount of time and logs the remaining time.
|
|
120
|
+
* @param totalWaitTimeMs - The total amount of time to wait.
|
|
121
|
+
* @param context - The context of the countdown.
|
|
122
|
+
* @returns A promise that resolves when the countdown is complete.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* await DyFM_Async.waitWithCountdownLogging(1000, 'Countdown');
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
100
129
|
static async waitWithCountdownLogging(
|
|
101
130
|
totalWaitTimeMs: number,
|
|
102
131
|
context: string = 'Countdown'
|
|
@@ -105,6 +134,17 @@ export class DyFM_Async {
|
|
|
105
134
|
const endTime = startTime + totalWaitTimeMs;
|
|
106
135
|
|
|
107
136
|
// Define logging intervals based on total duration
|
|
137
|
+
/**
|
|
138
|
+
* Gets the logging interval based on the total duration.
|
|
139
|
+
* @param totalMs - The total duration in milliseconds.
|
|
140
|
+
* @returns The logging interval in milliseconds.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const logInterval = getLogInterval(1000);
|
|
145
|
+
* console.log(logInterval); // 1000
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
108
148
|
const getLogInterval = (totalMs: number): number => {
|
|
109
149
|
const totalSeconds = totalMs / second;
|
|
110
150
|
const totalMinutes = totalSeconds / 60;
|
|
@@ -32,6 +32,12 @@ export class DyFM_JsonErrorHelper {
|
|
|
32
32
|
* @param jsonInput - The original JSON input string
|
|
33
33
|
* @param contextLines - Number of context lines to show before and after the error (default: 5)
|
|
34
34
|
* @returns Object containing line number, context lines, and character position, or null if parsing fails
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const lineInfo = DyFM_JsonErrorHelper.extractLineInfoFromJsonError('Expected property name or "}" in JSON at position 10', '{"name": "John", "age": 30}', 5);
|
|
39
|
+
* console.log(lineInfo); // { lineNumber: 1, contextLines: [ '{"name": "John", "age": 30}' ], characterPosition: 10 }
|
|
40
|
+
* ```
|
|
35
41
|
*/
|
|
36
42
|
static extractLineInfoFromJsonError(
|
|
37
43
|
errorMessage: string,
|
|
@@ -86,6 +92,16 @@ export class DyFM_JsonErrorHelper {
|
|
|
86
92
|
|
|
87
93
|
/**
|
|
88
94
|
* Helper method to create line info from a character position
|
|
95
|
+
* @param jsonInput - The original JSON input string
|
|
96
|
+
* @param position - The character position where the error occurred
|
|
97
|
+
* @param contextLines - Number of context lines to show before and after the error (default: 5)
|
|
98
|
+
* @returns Object containing line number, context lines, and character position
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const lineInfo = DyFM_JsonErrorHelper.createLineInfoFromPosition('{"name": "John", "age": 30}', 10, 5);
|
|
103
|
+
* console.log(lineInfo); // { lineNumber: 1, contextLines: [ '{"name": "John", "age": 30}' ], characterPosition: 10 }
|
|
104
|
+
* ```
|
|
89
105
|
*/
|
|
90
106
|
private static createLineInfoFromPosition(
|
|
91
107
|
jsonInput: string,
|
|
@@ -152,6 +168,12 @@ export class DyFM_JsonErrorHelper {
|
|
|
152
168
|
* @param lineInfo - The line information extracted from the error
|
|
153
169
|
* @param errorMessage - The original error message
|
|
154
170
|
* @returns Formatted error string for logging
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const logLines = DyFM_JsonErrorHelper.formatJsonErrorForLogging({ lineNumber: 1, contextLines: [ '{"name": "John", "age": 30}' ], characterPosition: 10 }, 'Expected property name or "}" in JSON at position 10');
|
|
175
|
+
* console.log(logLines); // [ 'JSON parsing failed: Expected property name or "}" in JSON at position 10', 'Error at line 1, character 10:', 'Context (1 lines):', ' 1: {"name": "John", "age": 30}' ]
|
|
176
|
+
* ```
|
|
155
177
|
*/
|
|
156
178
|
static formatJsonErrorForLogging(
|
|
157
179
|
lineInfo: JsonErrorLineInfo,
|
|
@@ -185,6 +207,13 @@ export class DyFM_JsonErrorHelper {
|
|
|
185
207
|
* @param contextLines - Number of context lines to show in error (default: 5)
|
|
186
208
|
* @returns Parsed JSON object
|
|
187
209
|
* @throws Error with detailed line information if parsing fails
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* const json = '{"name": "John", "age": 30}';
|
|
214
|
+
* const result = DyFM_JsonErrorHelper.parseJsonWithEnhancedError(json);
|
|
215
|
+
* console.log(result); // { name: 'John', age: 30 }
|
|
216
|
+
* ```
|
|
188
217
|
*/
|
|
189
218
|
static parseJsonWithEnhancedError(
|
|
190
219
|
jsonString: string,
|
|
@@ -235,6 +264,15 @@ export class DyFM_JsonErrorHelper {
|
|
|
235
264
|
|
|
236
265
|
/**
|
|
237
266
|
* Formats single-line JSON with line breaks for better error reporting
|
|
267
|
+
* @param jsonString - The JSON string to format
|
|
268
|
+
* @returns The formatted JSON string
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* const json = '{"name": "John", "age": 30, "city": "New York"}';
|
|
273
|
+
* const result = DyFM_JsonErrorHelper.formatJsonForBetterErrors(json);
|
|
274
|
+
* console.log(result); // '{\n "name": "John",\n "age": 30,\n "city": "New York"\n}'
|
|
275
|
+
* ```
|
|
238
276
|
*/
|
|
239
277
|
private static formatJsonForBetterErrors(jsonString: string): string {
|
|
240
278
|
if (!jsonString || typeof jsonString !== 'string') {
|