@futdevpro/fsm-dynamo 1.9.9 → 1.9.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.
Files changed (173) hide show
  1. package/.github/workflows/main.yml +196 -0
  2. package/HOWTO.md +15 -15
  3. package/README.md +17 -17
  4. package/build/_collections/constants/country-divisions.const.d.ts +1 -1
  5. package/build/_collections/constants/country-divisions.const.d.ts.map +1 -1
  6. package/build/_collections/constants/country-divisions.const.js +2 -2
  7. package/build/_collections/constants/country-divisions.const.js.map +1 -1
  8. package/build/_collections/constants/courtry-isos.const.d.ts +1 -1
  9. package/build/_collections/constants/courtry-isos.const.d.ts.map +1 -1
  10. package/build/_collections/constants/courtry-isos.const.js +2 -2
  11. package/build/_collections/constants/courtry-isos.const.js.map +1 -1
  12. package/build/_collections/constants/error-defaults.const.d.ts +1 -1
  13. package/build/_collections/constants/error-defaults.const.d.ts.map +1 -1
  14. package/build/_collections/constants/module-settings/usage-module-settings.const.js +1 -1
  15. package/build/_collections/constants/pipe-transforms.const.js +12 -12
  16. package/build/_collections/constants/pipe-transforms.const.js.map +1 -1
  17. package/build/_collections/utils/pipe-transforms/division-pipe.util.js +1 -1
  18. package/build/_collections/utils/pipe-transforms/division-pipe.util.js.map +1 -1
  19. package/build/_collections/utils/pipe-transforms/list-pipe.util.d.ts.map +1 -1
  20. package/build/_collections/utils/pipe-transforms/list-pipe.util.js.map +1 -1
  21. package/build/_collections/utils/pipe-transforms/range-pipe.util.d.ts +2 -2
  22. package/build/_collections/utils/pipe-transforms/range-pipe.util.d.ts.map +1 -1
  23. package/build/_collections/utils/pipe-transforms/range-pipe.util.js +11 -11
  24. package/build/_collections/utils/pipe-transforms/range-pipe.util.js.map +1 -1
  25. package/build/_collections/utils/regions.util.d.ts.map +1 -1
  26. package/build/_collections/utils/regions.util.js +3 -0
  27. package/build/_collections/utils/regions.util.js.map +1 -1
  28. package/build/_enums/range-pipe-setting.enum.d.ts +1 -1
  29. package/build/_enums/range-pipe-setting.enum.d.ts.map +1 -1
  30. package/build/_enums/range-pipe-setting.enum.js +12 -12
  31. package/build/_enums/range-pipe-setting.enum.js.map +1 -1
  32. package/build/_models/control-models/error.control-model.js +1 -1
  33. package/build/_models/control-models/error.control-model.js.map +1 -1
  34. package/build/_models/control-models/error.control-model.spec.js +25 -6
  35. package/build/_models/control-models/error.control-model.spec.js.map +1 -1
  36. package/build/_models/interfaces/index.d.ts +3 -0
  37. package/build/_models/interfaces/index.d.ts.map +1 -1
  38. package/build/_models/interfaces/index.js +3 -0
  39. package/build/_models/interfaces/index.js.map +1 -1
  40. package/build/_models/interfaces/pipe-transforms.interface.d.ts +2 -2
  41. package/build/_models/interfaces/pipe-transforms.interface.d.ts.map +1 -1
  42. package/futdevpro-fsm-dynamo-01.09.12.tgz +0 -0
  43. package/nodemon.json +11 -11
  44. package/package.json +151 -151
  45. package/src/_collections/assets/location/country-codes-ISO-3166.json +3239 -3239
  46. package/src/_collections/assets/location/country-divisions-ISO-3166-all-list.json +19035 -19035
  47. package/src/_collections/assets/location/country-divisions-ISO-3166.json +4993 -4993
  48. package/src/_collections/assets/location/country-phone-codes.json +1203 -1203
  49. package/src/_collections/constants/country-divisions.const.ts +9 -9
  50. package/src/_collections/constants/courtry-isos.const.ts +8 -8
  51. package/src/_collections/constants/error-defaults.const.ts +11 -11
  52. package/src/_collections/constants/index.ts +15 -15
  53. package/src/_collections/constants/module-settings/custom-data-module-settings.const.ts +15 -15
  54. package/src/_collections/constants/module-settings/index.ts +8 -8
  55. package/src/_collections/constants/module-settings/test-module-settings.const.ts +19 -19
  56. package/src/_collections/constants/module-settings/usage-module-settings.const.ts +19 -19
  57. package/src/_collections/constants/pipe-transforms.const.ts +35 -35
  58. package/src/_collections/constants/times.const.ts +8 -8
  59. package/src/_collections/index.ts +6 -6
  60. package/src/_collections/utils/array.util.spec.ts +39 -39
  61. package/src/_collections/utils/array.util.ts +137 -137
  62. package/src/_collections/utils/index.ts +18 -18
  63. package/src/_collections/utils/location.util.ts +55 -55
  64. package/src/_collections/utils/log.util.ts +239 -239
  65. package/src/_collections/utils/math/box-bounds.util.ts +85 -85
  66. package/src/_collections/utils/math/index.ts +5 -5
  67. package/src/_collections/utils/math/math.util.ts +53 -53
  68. package/src/_collections/utils/math/random.util.ts +80 -80
  69. package/src/_collections/utils/math/trigonometry.util.ts +73 -73
  70. package/src/_collections/utils/math/vector2.util.ts +197 -197
  71. package/src/_collections/utils/pipe-transforms/country-pipe.util.ts +18 -18
  72. package/src/_collections/utils/pipe-transforms/custom-pipe.util.ts +9 -9
  73. package/src/_collections/utils/pipe-transforms/division-pipe.util.ts +20 -20
  74. package/src/_collections/utils/pipe-transforms/index.ts +15 -15
  75. package/src/_collections/utils/pipe-transforms/list-pipe.util.ts +10 -14
  76. package/src/_collections/utils/pipe-transforms/multi-pipe-pipe.util.ts +160 -160
  77. package/src/_collections/utils/pipe-transforms/obj-key-pipe.util.ts +9 -9
  78. package/src/_collections/utils/pipe-transforms/range-pipe.util.ts +94 -94
  79. package/src/_collections/utils/pipe-transforms/region-pipe.util.ts +18 -18
  80. package/src/_collections/utils/pipe-transforms/replace-pipe.util.ts +11 -11
  81. package/src/_collections/utils/pipe-transforms/slider-pipe.util.ts +20 -20
  82. package/src/_collections/utils/pipe-transforms/smart-replace-pipe.util.ts +71 -71
  83. package/src/_collections/utils/regex/index.ts +4 -4
  84. package/src/_collections/utils/regex/password-regex.util.ts +52 -52
  85. package/src/_collections/utils/regex/regex.util.ts +6 -6
  86. package/src/_collections/utils/regex/username-regex.util.ts +33 -33
  87. package/src/_collections/utils/regions.util.ts +100 -97
  88. package/src/_collections/utils/round-list.util.ts +44 -44
  89. package/src/_collections/utils/shared.static-service.ts +177 -177
  90. package/src/_collections/utils/time.util.spec.ts +50 -50
  91. package/src/_collections/utils/time.util.ts +219 -219
  92. package/src/_collections/utils/type-cloning-facility.util.ts +121 -121
  93. package/src/_collections/utils/utilities.util.ts +130 -130
  94. package/src/_enums/basic-property-type.enum.ts +9 -9
  95. package/src/_enums/data-model-type.enum.ts +13 -13
  96. package/src/_enums/day-of-week.enum.ts +28 -28
  97. package/src/_enums/error-level.enum.ts +17 -17
  98. package/src/_enums/index.ts +16 -16
  99. package/src/_enums/location/index.ts +3 -3
  100. package/src/_enums/location/region.enum.ts +9 -9
  101. package/src/_enums/location/sub-region.enum.ts +26 -26
  102. package/src/_enums/location/subdivision-region-type.enum.ts +44 -44
  103. package/src/_enums/log-style.enum.ts +30 -30
  104. package/src/_enums/month.enum.ts +16 -16
  105. package/src/_enums/pipe.enum.ts +45 -45
  106. package/src/_enums/range-pipe-setting.enum.ts +11 -11
  107. package/src/_enums/time/day-of-week.enum.ts +28 -28
  108. package/src/_enums/time/index.ts +3 -3
  109. package/src/_enums/time/month.enum.ts +16 -16
  110. package/src/_enums/time/relative-date.enum.ts +13 -13
  111. package/src/_models/control-models/daily-usage-data.control-model.ts +21 -21
  112. package/src/_models/control-models/data-model-params.control-model.ts +39 -39
  113. package/src/_models/control-models/data-property-params.control-model.ts +106 -106
  114. package/src/_models/control-models/error.control-model.spec.ts +753 -716
  115. package/src/_models/control-models/error.control-model.ts +722 -722
  116. package/src/_models/control-models/index.ts +10 -10
  117. package/src/_models/control-models/poll.control-model.ts +113 -113
  118. package/src/_models/control-models/range-value.control-model.ts +142 -142
  119. package/src/_models/control-models/usage-action.control-model.ts +15 -15
  120. package/src/_models/control-models/usage-data.control-model.ts +20 -20
  121. package/src/_models/data-models/custom-data.data-model.ts +28 -28
  122. package/src/_models/data-models/index.ts +5 -5
  123. package/src/_models/data-models/metadata.data-model.ts +83 -83
  124. package/src/_models/data-models/usage-session.data-model.ts +53 -53
  125. package/src/_models/index.ts +12 -12
  126. package/src/_models/interfaces/error-defaults.interface.ts +11 -11
  127. package/src/_models/interfaces/index.ts +11 -8
  128. package/src/_models/interfaces/location/country-division.interface.ts +7 -7
  129. package/src/_models/interfaces/location/country-iso.interface.ts +21 -21
  130. package/src/_models/interfaces/location/country-phone-code.interface.ts +7 -7
  131. package/src/_models/interfaces/location/division-collection.interface.ts +10 -10
  132. package/src/_models/interfaces/location/division-region-data.interface.ts +8 -8
  133. package/src/_models/interfaces/location/geo-ip-location.interface.ts +26 -26
  134. package/src/_models/interfaces/location/index.ts +10 -10
  135. package/src/_models/interfaces/location/location-coordinates.interface.ts +5 -5
  136. package/src/_models/interfaces/multi-pipe-settings.type.ts +7 -7
  137. package/src/_models/interfaces/paged.interface.ts +11 -11
  138. package/src/_models/interfaces/pipe-transforms.interface.ts +29 -29
  139. package/src/_models/interfaces/random-weight.interface.ts +7 -7
  140. package/src/_models/interfaces/route-settings.interface.ts +11 -11
  141. package/src/_modules/collections.index.ts +2 -2
  142. package/src/_modules/constants.index.ts +2 -2
  143. package/src/_modules/custom-data-module.index.ts +6 -6
  144. package/src/_modules/data-modules.index.ts +9 -9
  145. package/src/_modules/enums.index.ts +2 -2
  146. package/src/_modules/error-module.index.ts +8 -8
  147. package/src/_modules/location.index.ts +15 -15
  148. package/src/_modules/models.index.ts +2 -2
  149. package/src/_modules/shared-service.index.ts +9 -9
  150. package/src/_modules/test-module.index.ts +5 -5
  151. package/src/_modules/usage-module.index.ts +10 -10
  152. package/tsconfig.json +29 -29
  153. package/tslint.json +153 -153
  154. package/build/_enums/region.enum.d.ts +0 -8
  155. package/build/_enums/region.enum.d.ts.map +0 -1
  156. package/build/_enums/region.enum.js +0 -12
  157. package/build/_enums/region.enum.js.map +0 -1
  158. package/build/_enums/relative-date.enum.d.ts +0 -9
  159. package/build/_enums/relative-date.enum.d.ts.map +0 -1
  160. package/build/_enums/relative-date.enum.js +0 -13
  161. package/build/_enums/relative-date.enum.js.map +0 -1
  162. package/build/_enums/sub-region.enum.d.ts +0 -20
  163. package/build/_enums/sub-region.enum.d.ts.map +0 -1
  164. package/build/_enums/sub-region.enum.js +0 -24
  165. package/build/_enums/sub-region.enum.js.map +0 -1
  166. package/build/_enums/subdivision-region-type.enum.d.ts +0 -41
  167. package/build/_enums/subdivision-region-type.enum.d.ts.map +0 -1
  168. package/build/_enums/subdivision-region-type.enum.js +0 -46
  169. package/build/_enums/subdivision-region-type.enum.js.map +0 -1
  170. package/src/_enums/region.enum.ts +0 -9
  171. package/src/_enums/relative-date.enum.ts +0 -13
  172. package/src/_enums/sub-region.enum.ts +0 -26
  173. package/src/_enums/subdivision-region-type.enum.ts +0 -44
@@ -1,161 +1,161 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
- import { DynamoFM_AngularMultiPipeAvailable, DynamoFM_MultiPipeAvailable, DynamoFM_Pipe, DynamoFM_allDynamoPipes, DynamoFM_allMultiPipesAvailable } from '../../../_enums';
9
- import { DynamoFM_RangeValue } from '../../../_models';
10
- import { DynamoFM_MultiPipe_Setting } from '../../../_models/interfaces/multi-pipe-settings.type';
11
- import { DynamoFM_pipeTransforms } from '../../constants';
12
-
13
-
14
- export type DynamoFM_MultiPipeAngularPipes = {
15
- [pipeName in DynamoFM_AngularMultiPipeAvailable]: (value: string, ...args: unknown[]) => string;
16
- };
17
-
18
- export const DynamoFM_multiPipeAngularPipes: DynamoFM_MultiPipeAngularPipes = {
19
- [DynamoFM_AngularMultiPipeAvailable.currency]: null,
20
- [DynamoFM_AngularMultiPipeAvailable.date]: null,
21
- [DynamoFM_AngularMultiPipeAvailable.decimal]: null,
22
- [DynamoFM_AngularMultiPipeAvailable.number]: null,
23
- [DynamoFM_AngularMultiPipeAvailable.percent]: null,
24
- };
25
-
26
- export function DynamoFM_multiPipe_pipeTransform(
27
- value: unknown, pipes: DynamoFM_MultiPipe_Setting[]
28
- ): string | number | DynamoFM_RangeValue | any {
29
- /* console.log(
30
- 'applyPipes...',
31
- '\nvalue:', value,
32
- '\npipes:', DynamoFM_clone(pipes)
33
- ); */
34
-
35
- stackPipes(pipes);
36
-
37
- /* console.log('stacked pipes:', DynamoFM_clone(pipes)); */
38
-
39
- for (let i = 0; i < pipes.length; i++) {
40
- const pipe: DynamoFM_MultiPipe_Setting = pipes[i];
41
- /* pipes.forEach((pipe: DynamoFM_MultiPipe_Setting): void => { */
42
- const keys: string[] = Object.keys(pipe);
43
-
44
- if (keys.length !== 1) {
45
- console.warn(
46
- 'DYNAMO WARNING: ' +
47
- '\nMultiPipe: pipeSettings has more than one key...',
48
- '\npipeSettings: ', pipe,
49
- '\n\n',
50
- new Error()
51
- );
52
-
53
- return value;
54
- }
55
-
56
- const pipeName: DynamoFM_MultiPipeAvailable = keys[0] as DynamoFM_MultiPipeAvailable;
57
-
58
- if (!DynamoFM_allMultiPipesAvailable.includes(pipeName as DynamoFM_MultiPipeAvailable)) {
59
- console.warn(
60
- 'DYNAMO WARNING: ' +
61
- '\nMultiPipe: unknown pipe "' + pipeName + '"...',
62
- '\nsorry, but this pipe is not supported by the MultiPipe yet.',
63
- '\navailable pipes are: ' + DynamoFM_allMultiPipesAvailable.join(', '),
64
- '\nthe custom pipe is basically usable for anything, you might try to use that.',
65
- '\n\n',
66
- new Error()
67
- );
68
-
69
- return value;
70
- }
71
-
72
- const pipeArgs: any[] = pipe[pipeName];
73
-
74
- /* console.log(
75
- 'transforming...',
76
- '\npipe:', pipeName,
77
- '\nargs:', pipeArgs,
78
- '\nvalue:', value
79
- ); */
80
-
81
- if (DynamoFM_allDynamoPipes.includes(pipeName as DynamoFM_Pipe)) {
82
- if (pipeArgs?.length) {
83
- value = DynamoFM_pipeTransforms[pipeName](value, ...pipeArgs);
84
- } else {
85
- value = DynamoFM_pipeTransforms[pipeName](value);
86
- }
87
- } else {
88
- if (!DynamoFM_multiPipeAngularPipes[pipeName]) {
89
- console.error(
90
- 'DYNAMO ERROR: ' +
91
- '\nMultiPipe: Angular pipe "' + pipeName + '" is not defined...',
92
- '\nPlease set the pipe in the DynamoFM_multiPipeAngularPipes object.',
93
- '\n\n',
94
- new Error()
95
- );
96
-
97
- return value;
98
- }
99
-
100
- value = DynamoFM_multiPipeAngularPipes[pipeName](value, ...pipeArgs);
101
- }
102
- }
103
-
104
- return value;
105
- }
106
-
107
- /**
108
- * This method stacks the pipes in the pipe settings.
109
- * Developing this funcfion you must know which pipe have multiPipe settings
110
- * and which argument is that
111
- *
112
- * IMPORTANT: the args are starting from the second transform argument!
113
- *
114
- * @param pipes
115
- */
116
- function stackPipes(pipes: DynamoFM_MultiPipe_Setting[]): void {
117
- for (let i = 0; i < pipes.length; i++) {
118
- if (i + 1 < pipes.length) {
119
- const pipe: DynamoFM_MultiPipe_Setting = pipes[i];
120
- const pipeName: DynamoFM_MultiPipeAvailable =
121
- Object.keys(pipe)[0] as DynamoFM_MultiPipeAvailable;
122
-
123
- switch (pipeName) {
124
- case DynamoFM_Pipe.range:
125
- const furtherPipesAfterRange: DynamoFM_MultiPipe_Setting[] = pipes.splice(i + 1);
126
-
127
- if (!(pipe[pipeName] as any[])?.length) {
128
- (pipe[pipeName] as any[]) = [ null, furtherPipesAfterRange ];
129
- } else if ((pipe[pipeName][1] as any[])?.length) {
130
- (pipe[pipeName][1] as any[]).push(...furtherPipesAfterRange);
131
- } else {
132
- (pipe[pipeName][1] as DynamoFM_MultiPipe_Setting[]) = furtherPipesAfterRange;
133
- }
134
- break;
135
-
136
- case DynamoFM_Pipe.smartReplace:
137
- const furtherPipesAfterSR: DynamoFM_MultiPipe_Setting[] = pipes.splice(i + 1);
138
-
139
- if (!(pipe[pipeName] as any[])?.length) {
140
- throw new Error(
141
- 'DYNAMO ERROR: ' +
142
- '\nMultiPipe: SmartReplacePipe has no arguments...' +
143
- '\nSmartReplacePipe needs at least one argument: replaceTo.' +
144
- '\nMaybe you forgot to put the replacerObject in an array?' +
145
- '\n\n'
146
- );
147
- }
148
-
149
- if ((pipe[pipeName][1] as any[])?.length) {
150
- (pipe[pipeName][1] as any[]).push(...furtherPipesAfterSR);
151
- } else {
152
- (pipe[pipeName][1] as DynamoFM_MultiPipe_Setting[]) = furtherPipesAfterSR;
153
- }
154
- break;
155
-
156
- default:
157
- break;
158
- }
159
- }
160
- }
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+ import { DynamoFM_AngularMultiPipeAvailable, DynamoFM_MultiPipeAvailable, DynamoFM_Pipe, DynamoFM_allDynamoPipes, DynamoFM_allMultiPipesAvailable } from '../../../_enums';
9
+ import { DynamoFM_RangeValue } from '../../../_models';
10
+ import { DynamoFM_MultiPipe_Setting } from '../../../_models/interfaces/multi-pipe-settings.type';
11
+ import { DynamoFM_pipeTransforms } from '../../constants';
12
+
13
+
14
+ export type DynamoFM_MultiPipeAngularPipes = {
15
+ [pipeName in DynamoFM_AngularMultiPipeAvailable]: (value: string, ...args: unknown[]) => string;
16
+ };
17
+
18
+ export const DynamoFM_multiPipeAngularPipes: DynamoFM_MultiPipeAngularPipes = {
19
+ [DynamoFM_AngularMultiPipeAvailable.currency]: null,
20
+ [DynamoFM_AngularMultiPipeAvailable.date]: null,
21
+ [DynamoFM_AngularMultiPipeAvailable.decimal]: null,
22
+ [DynamoFM_AngularMultiPipeAvailable.number]: null,
23
+ [DynamoFM_AngularMultiPipeAvailable.percent]: null,
24
+ };
25
+
26
+ export function DynamoFM_multiPipe_pipeTransform(
27
+ value: unknown, pipes: DynamoFM_MultiPipe_Setting[]
28
+ ): string | number | DynamoFM_RangeValue | any {
29
+ /* console.log(
30
+ 'applyPipes...',
31
+ '\nvalue:', value,
32
+ '\npipes:', DynamoFM_clone(pipes)
33
+ ); */
34
+
35
+ stackPipes(pipes);
36
+
37
+ /* console.log('stacked pipes:', DynamoFM_clone(pipes)); */
38
+
39
+ for (let i = 0; i < pipes.length; i++) {
40
+ const pipe: DynamoFM_MultiPipe_Setting = pipes[i];
41
+ /* pipes.forEach((pipe: DynamoFM_MultiPipe_Setting): void => { */
42
+ const keys: string[] = Object.keys(pipe);
43
+
44
+ if (keys.length !== 1) {
45
+ console.warn(
46
+ 'DYNAMO WARNING: ' +
47
+ '\nMultiPipe: pipeSettings has more than one key...',
48
+ '\npipeSettings: ', pipe,
49
+ '\n\n',
50
+ new Error()
51
+ );
52
+
53
+ return value;
54
+ }
55
+
56
+ const pipeName: DynamoFM_MultiPipeAvailable = keys[0] as DynamoFM_MultiPipeAvailable;
57
+
58
+ if (!DynamoFM_allMultiPipesAvailable.includes(pipeName as DynamoFM_MultiPipeAvailable)) {
59
+ console.warn(
60
+ 'DYNAMO WARNING: ' +
61
+ '\nMultiPipe: unknown pipe "' + pipeName + '"...',
62
+ '\nsorry, but this pipe is not supported by the MultiPipe yet.',
63
+ '\navailable pipes are: ' + DynamoFM_allMultiPipesAvailable.join(', '),
64
+ '\nthe custom pipe is basically usable for anything, you might try to use that.',
65
+ '\n\n',
66
+ new Error()
67
+ );
68
+
69
+ return value;
70
+ }
71
+
72
+ const pipeArgs: any[] = pipe[pipeName];
73
+
74
+ /* console.log(
75
+ 'transforming...',
76
+ '\npipe:', pipeName,
77
+ '\nargs:', pipeArgs,
78
+ '\nvalue:', value
79
+ ); */
80
+
81
+ if (DynamoFM_allDynamoPipes.includes(pipeName as DynamoFM_Pipe)) {
82
+ if (pipeArgs?.length) {
83
+ value = DynamoFM_pipeTransforms[pipeName](value, ...pipeArgs);
84
+ } else {
85
+ value = DynamoFM_pipeTransforms[pipeName](value);
86
+ }
87
+ } else {
88
+ if (!DynamoFM_multiPipeAngularPipes[pipeName]) {
89
+ console.error(
90
+ 'DYNAMO ERROR: ' +
91
+ '\nMultiPipe: Angular pipe "' + pipeName + '" is not defined...',
92
+ '\nPlease set the pipe in the DynamoFM_multiPipeAngularPipes object.',
93
+ '\n\n',
94
+ new Error()
95
+ );
96
+
97
+ return value;
98
+ }
99
+
100
+ value = DynamoFM_multiPipeAngularPipes[pipeName](value, ...pipeArgs);
101
+ }
102
+ }
103
+
104
+ return value;
105
+ }
106
+
107
+ /**
108
+ * This method stacks the pipes in the pipe settings.
109
+ * Developing this funcfion you must know which pipe have multiPipe settings
110
+ * and which argument is that
111
+ *
112
+ * IMPORTANT: the args are starting from the second transform argument!
113
+ *
114
+ * @param pipes
115
+ */
116
+ function stackPipes(pipes: DynamoFM_MultiPipe_Setting[]): void {
117
+ for (let i = 0; i < pipes.length; i++) {
118
+ if (i + 1 < pipes.length) {
119
+ const pipe: DynamoFM_MultiPipe_Setting = pipes[i];
120
+ const pipeName: DynamoFM_MultiPipeAvailable =
121
+ Object.keys(pipe)[0] as DynamoFM_MultiPipeAvailable;
122
+
123
+ switch (pipeName) {
124
+ case DynamoFM_Pipe.range:
125
+ const furtherPipesAfterRange: DynamoFM_MultiPipe_Setting[] = pipes.splice(i + 1);
126
+
127
+ if (!(pipe[pipeName] as any[])?.length) {
128
+ (pipe[pipeName] as any[]) = [ null, furtherPipesAfterRange ];
129
+ } else if ((pipe[pipeName][1] as any[])?.length) {
130
+ (pipe[pipeName][1] as any[]).push(...furtherPipesAfterRange);
131
+ } else {
132
+ (pipe[pipeName][1] as DynamoFM_MultiPipe_Setting[]) = furtherPipesAfterRange;
133
+ }
134
+ break;
135
+
136
+ case DynamoFM_Pipe.smartReplace:
137
+ const furtherPipesAfterSR: DynamoFM_MultiPipe_Setting[] = pipes.splice(i + 1);
138
+
139
+ if (!(pipe[pipeName] as any[])?.length) {
140
+ throw new Error(
141
+ 'DYNAMO ERROR: ' +
142
+ '\nMultiPipe: SmartReplacePipe has no arguments...' +
143
+ '\nSmartReplacePipe needs at least one argument: replaceTo.' +
144
+ '\nMaybe you forgot to put the replacerObject in an array?' +
145
+ '\n\n'
146
+ );
147
+ }
148
+
149
+ if ((pipe[pipeName][1] as any[])?.length) {
150
+ (pipe[pipeName][1] as any[]).push(...furtherPipesAfterSR);
151
+ } else {
152
+ (pipe[pipeName][1] as DynamoFM_MultiPipe_Setting[]) = furtherPipesAfterSR;
153
+ }
154
+ break;
155
+
156
+ default:
157
+ break;
158
+ }
159
+ }
160
+ }
161
161
  }
@@ -1,9 +1,9 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
- export function DynamoFM_objKey_pipeTransform<Obj_T>(value: Obj_T): string[] {
8
- return value ? Object.keys(value) : [];
9
- }
1
+
2
+
3
+
4
+
5
+
6
+
7
+ export function DynamoFM_objKey_pipeTransform<Obj_T>(value: Obj_T): string[] {
8
+ return value ? Object.keys(value) : [];
9
+ }
@@ -1,94 +1,94 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
- import { DynamoFM_RangePipeSetting } from '../../../_enums';
9
- import { DynamoFM_RangeValue } from '../../../_models';
10
- import { DynamoFM_MultiPipe_Setting } from '../../../_models/interfaces/multi-pipe-settings.type';
11
- import { DynamoFM_multiPipe_pipeTransform } from './multi-pipe-pipe.util';
12
-
13
- export function DynamoFM_range_pipeTransform(
14
- value: DynamoFM_RangeValue,
15
- setting: DynamoFM_RangePipeSetting,
16
- multiPipes?: DynamoFM_MultiPipe_Setting[]
17
- ): string | number | DynamoFM_RangeValue {
18
- if (!checkRangePipeRequirements(value, setting, multiPipes)) {
19
- return value;
20
- }
21
-
22
- switch (setting) {
23
- case DynamoFM_RangePipeSetting.avg:
24
- case DynamoFM_RangePipeSetting.average:
25
- return (value.to + value.from) / 2;
26
-
27
- case DynamoFM_RangePipeSetting.min:
28
- case DynamoFM_RangePipeSetting.from:
29
- return value.from;
30
-
31
- case DynamoFM_RangePipeSetting.max:
32
- case DynamoFM_RangePipeSetting.to:
33
- return value.to;
34
-
35
- case DynamoFM_RangePipeSetting.both:
36
- case DynamoFM_RangePipeSetting.fromTo:
37
- if (0 < multiPipes?.length) {
38
- if (value.from === value.to) {
39
- return DynamoFM_multiPipe_pipeTransform(value.from, multiPipes);
40
- } else {
41
- return DynamoFM_multiPipe_pipeTransform(value.from, multiPipes) +
42
- ' - ' +
43
- DynamoFM_multiPipe_pipeTransform(value.to, multiPipes);
44
- }
45
- } else {
46
- return `${value.from} - ${value.to}`;
47
- }
48
-
49
- default:
50
- return value;
51
- }
52
- }
53
-
54
- function checkRangePipeRequirements(
55
- value: DynamoFM_RangeValue,
56
- setting: DynamoFM_RangePipeSetting | string,
57
- multiPipes?: DynamoFM_MultiPipe_Setting[]
58
- ): boolean {
59
- if (!value?.isRange) {
60
- console.warn(
61
- 'DYNAMO WARNING: ' +
62
- '\nRangePipe: value is not a DynamoFM_RangeValue...',
63
- '\nrange pipe is only usable for DynamoFM_RangeValue.',
64
- '\nvalue: ', value,
65
- '\n\n',
66
- new Error()
67
- );
68
-
69
- return false;
70
- }
71
-
72
- if (!setting) {
73
- setting = DynamoFM_RangePipeSetting.fromTo;
74
- }
75
-
76
- if (
77
- setting !== DynamoFM_RangePipeSetting.both &&
78
- setting !== DynamoFM_RangePipeSetting.fromTo &&
79
- 0 < multiPipes?.length
80
- ) {
81
- console.warn(
82
- 'DYNAMO WARNING: ' +
83
- '\nRangePipe: you can only use further pipes with setting "both"/"from-to"...',
84
- '\nThere is no need to use this special syntax for the other pipes.',
85
- '\nvalue: ', value,
86
- '\nsetting: ', setting,
87
- '\nfurtherPipes: ', multiPipes,
88
- '\n\n',
89
- new Error()
90
- );
91
- }
92
-
93
- return true;
94
- }
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+ import { DynamoFM_RangePipe_Setting } from '../../../_enums';
9
+ import { DynamoFM_RangeValue } from '../../../_models';
10
+ import { DynamoFM_MultiPipe_Setting } from '../../../_models/interfaces/multi-pipe-settings.type';
11
+ import { DynamoFM_multiPipe_pipeTransform } from './multi-pipe-pipe.util';
12
+
13
+ export function DynamoFM_range_pipeTransform(
14
+ value: DynamoFM_RangeValue,
15
+ setting: DynamoFM_RangePipe_Setting,
16
+ multiPipes?: DynamoFM_MultiPipe_Setting[]
17
+ ): string | number | DynamoFM_RangeValue {
18
+ if (!checkRangePipeRequirements(value, setting, multiPipes)) {
19
+ return value;
20
+ }
21
+
22
+ switch (setting) {
23
+ case DynamoFM_RangePipe_Setting.avg:
24
+ case DynamoFM_RangePipe_Setting.average:
25
+ return (value.to + value.from) / 2;
26
+
27
+ case DynamoFM_RangePipe_Setting.min:
28
+ case DynamoFM_RangePipe_Setting.from:
29
+ return value.from;
30
+
31
+ case DynamoFM_RangePipe_Setting.max:
32
+ case DynamoFM_RangePipe_Setting.to:
33
+ return value.to;
34
+
35
+ case DynamoFM_RangePipe_Setting.both:
36
+ case DynamoFM_RangePipe_Setting.fromTo:
37
+ if (0 < multiPipes?.length) {
38
+ if (value.from === value.to) {
39
+ return DynamoFM_multiPipe_pipeTransform(value.from, multiPipes);
40
+ } else {
41
+ return DynamoFM_multiPipe_pipeTransform(value.from, multiPipes) +
42
+ ' - ' +
43
+ DynamoFM_multiPipe_pipeTransform(value.to, multiPipes);
44
+ }
45
+ } else {
46
+ return `${value.from} - ${value.to}`;
47
+ }
48
+
49
+ default:
50
+ return value;
51
+ }
52
+ }
53
+
54
+ function checkRangePipeRequirements(
55
+ value: DynamoFM_RangeValue,
56
+ setting: DynamoFM_RangePipe_Setting | string,
57
+ multiPipes?: DynamoFM_MultiPipe_Setting[]
58
+ ): boolean {
59
+ if (!value?.isRange) {
60
+ console.warn(
61
+ 'DYNAMO WARNING: ' +
62
+ '\nRangePipe: value is not a DynamoFM_RangeValue...',
63
+ '\nrange pipe is only usable for DynamoFM_RangeValue.',
64
+ '\nvalue: ', value,
65
+ '\n\n',
66
+ new Error()
67
+ );
68
+
69
+ return false;
70
+ }
71
+
72
+ if (!setting) {
73
+ setting = DynamoFM_RangePipe_Setting.fromTo;
74
+ }
75
+
76
+ if (
77
+ setting !== DynamoFM_RangePipe_Setting.both &&
78
+ setting !== DynamoFM_RangePipe_Setting.fromTo &&
79
+ 0 < multiPipes?.length
80
+ ) {
81
+ console.warn(
82
+ 'DYNAMO WARNING: ' +
83
+ '\nRangePipe: you can only use further pipes with setting "both"/"from-to"...',
84
+ '\nThere is no need to use this special syntax for the other pipes.',
85
+ '\nvalue: ', value,
86
+ '\nsetting: ', setting,
87
+ '\nfurtherPipes: ', multiPipes,
88
+ '\n\n',
89
+ new Error()
90
+ );
91
+ }
92
+
93
+ return true;
94
+ }
@@ -1,18 +1,18 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
- import { DynamoFM_CountryISO } from '../../../_models';
9
- import { DynamoFM_countryISOs } from '../../constants/courtry-isos.const';
10
-
11
-
12
- export function DynamoFM_region_pipeTransform(countryISO: string): string {
13
- const result = DynamoFM_countryISOs.find(
14
- (iso: DynamoFM_CountryISO): boolean => iso.iso2 === countryISO
15
- )?.region;
16
-
17
- return result ?? countryISO;
18
- }
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+ import { DynamoFM_CountryISO } from '../../../_models';
9
+ import { DynamoFM_countryISOs } from '../../constants/courtry-isos.const';
10
+
11
+
12
+ export function DynamoFM_region_pipeTransform(countryISO: string): string {
13
+ const result = DynamoFM_countryISOs.find(
14
+ (iso: DynamoFM_CountryISO): boolean => iso.iso2 === countryISO
15
+ )?.region;
16
+
17
+ return result ?? countryISO;
18
+ }
@@ -1,11 +1,11 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
- export function DynamoFM_replace_pipeTransform(value: string, from: string, to: string): string {
10
- return value?.replaceAll(from, to) ?? value;
11
- }
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+ export function DynamoFM_replace_pipeTransform(value: string, from: string, to: string): string {
10
+ return value?.replaceAll(from, to) ?? value;
11
+ }
@@ -1,20 +1,20 @@
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
- import { DynamoFM_RangeValue } from '../../../_models';
9
-
10
- export function DynamoFM_slider_pipeTransform(
11
- value: number | DynamoFM_RangeValue<number> | string,
12
- ): string {
13
- if (value instanceof DynamoFM_RangeValue /* (value as DynamoFM_RangeValue).isRange */) {
14
- return value.toString();
15
- } else if (typeof value === 'number') {
16
- return `${value}`;
17
- } else {
18
- return value;
19
- }
20
- }
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+ import { DynamoFM_RangeValue } from '../../../_models';
9
+
10
+ export function DynamoFM_slider_pipeTransform(
11
+ value: number | DynamoFM_RangeValue<number> | string,
12
+ ): string {
13
+ if (value instanceof DynamoFM_RangeValue /* (value as DynamoFM_RangeValue).isRange */) {
14
+ return value.toString();
15
+ } else if (typeof value === 'number') {
16
+ return `${value}`;
17
+ } else {
18
+ return value;
19
+ }
20
+ }