@futdevpro/fsm-dynamo 1.15.1 → 1.15.2

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 (216) hide show
  1. package/.cursor/rules/__assistant_guide.mdc +30 -0
  2. package/.cursor/rules/__main.mdc +62 -0
  3. package/.cursor/rules/_ag_backend-structure.mdc +86 -0
  4. package/.cursor/rules/_ag_backend.mdc +16 -0
  5. package/.cursor/rules/_ag_debug.mdc +8 -0
  6. package/.cursor/rules/_ag_documentation_writing_rules.mdc +372 -0
  7. package/.cursor/rules/_ag_file-refactoring.mdc +113 -0
  8. package/.cursor/rules/_ag_fixes_rules.mdc +6 -0
  9. package/.cursor/rules/_ag_frontend-structure.mdc +87 -0
  10. package/.cursor/rules/_ag_frontend.mdc +40 -0
  11. package/.cursor/rules/_ag_import-rules.mdc +45 -0
  12. package/.cursor/rules/_ag_naming.mdc +116 -0
  13. package/.cursor/rules/_ag_running_commands.mdc +5 -0
  14. package/.cursor/rules/_ag_server-controller.mdc +6 -0
  15. package/.cursor/rules/_ag_should-be.mdc +7 -0
  16. package/.cursor/rules/_ag_swearing.mdc +47 -0
  17. package/.cursor/rules/ai_development_guide.md +61 -0
  18. package/.cursor/rules/ai_directives.md +114 -0
  19. package/.cursor/rules/cursor-rules.md +160 -0
  20. package/.cursor/rules/default-command.mdc +229 -0
  21. package/.cursor/rules/error_code_pattern.md +40 -0
  22. package/.cursor/rules/saved rule mcp server use.md +16 -0
  23. package/build/_modules/data-handler/_models/data-handler.control-model.js +17 -17
  24. package/build/_modules/data-handler/_models/data-handler.control-model.js.map +1 -1
  25. package/futdevpro-fsm-dynamo-01.15.2.tgz +0 -0
  26. package/package.json +2 -2
  27. package/src/_modules/data-handler/_models/data-handler.control-model.ts +17 -17
  28. package/build/_collections/utils/array.util.spec.d.ts +0 -2
  29. package/build/_collections/utils/array.util.spec.d.ts.map +0 -1
  30. package/build/_collections/utils/array.util.spec.js +0 -239
  31. package/build/_collections/utils/array.util.spec.js.map +0 -1
  32. package/build/_collections/utils/log.util.spec.d.ts +0 -2
  33. package/build/_collections/utils/log.util.spec.d.ts.map +0 -1
  34. package/build/_collections/utils/log.util.spec.js +0 -633
  35. package/build/_collections/utils/log.util.spec.js.map +0 -1
  36. package/build/_collections/utils/math/box-bounds.util.spec.d.ts +0 -2
  37. package/build/_collections/utils/math/box-bounds.util.spec.d.ts.map +0 -1
  38. package/build/_collections/utils/math/box-bounds.util.spec.js +0 -97
  39. package/build/_collections/utils/math/box-bounds.util.spec.js.map +0 -1
  40. package/build/_collections/utils/math/math.util.spec.d.ts +0 -2
  41. package/build/_collections/utils/math/math.util.spec.d.ts.map +0 -1
  42. package/build/_collections/utils/math/math.util.spec.js +0 -80
  43. package/build/_collections/utils/math/math.util.spec.js.map +0 -1
  44. package/build/_collections/utils/math/random.util.spec.d.ts +0 -2
  45. package/build/_collections/utils/math/random.util.spec.d.ts.map +0 -1
  46. package/build/_collections/utils/math/random.util.spec.js +0 -75
  47. package/build/_collections/utils/math/random.util.spec.js.map +0 -1
  48. package/build/_collections/utils/math/trigonometry.util.spec.d.ts +0 -2
  49. package/build/_collections/utils/math/trigonometry.util.spec.d.ts.map +0 -1
  50. package/build/_collections/utils/math/trigonometry.util.spec.js +0 -49
  51. package/build/_collections/utils/math/trigonometry.util.spec.js.map +0 -1
  52. package/build/_collections/utils/math/vector2.util.spec.d.ts +0 -2
  53. package/build/_collections/utils/math/vector2.util.spec.d.ts.map +0 -1
  54. package/build/_collections/utils/math/vector2.util.spec.js +0 -82
  55. package/build/_collections/utils/math/vector2.util.spec.js.map +0 -1
  56. package/build/_collections/utils/object.util.spec.d.ts +0 -2
  57. package/build/_collections/utils/object.util.spec.d.ts.map +0 -1
  58. package/build/_collections/utils/object.util.spec.js +0 -506
  59. package/build/_collections/utils/object.util.spec.js.map +0 -1
  60. package/build/_collections/utils/regex/password-regex.util.spec.d.ts +0 -2
  61. package/build/_collections/utils/regex/password-regex.util.spec.d.ts.map +0 -1
  62. package/build/_collections/utils/regex/password-regex.util.spec.js +0 -44
  63. package/build/_collections/utils/regex/password-regex.util.spec.js.map +0 -1
  64. package/build/_collections/utils/regex/regex.util.spec.d.ts +0 -2
  65. package/build/_collections/utils/regex/regex.util.spec.d.ts.map +0 -1
  66. package/build/_collections/utils/regex/regex.util.spec.js +0 -40
  67. package/build/_collections/utils/regex/regex.util.spec.js.map +0 -1
  68. package/build/_collections/utils/regex/username-regex.util.spec.d.ts +0 -2
  69. package/build/_collections/utils/regex/username-regex.util.spec.d.ts.map +0 -1
  70. package/build/_collections/utils/regex/username-regex.util.spec.js +0 -59
  71. package/build/_collections/utils/regex/username-regex.util.spec.js.map +0 -1
  72. package/build/_collections/utils/round-list.util.spec.d.ts +0 -2
  73. package/build/_collections/utils/round-list.util.spec.d.ts.map +0 -1
  74. package/build/_collections/utils/round-list.util.spec.js +0 -65
  75. package/build/_collections/utils/round-list.util.spec.js.map +0 -1
  76. package/build/_collections/utils/stack.util.spec.d.ts +0 -2
  77. package/build/_collections/utils/stack.util.spec.d.ts.map +0 -1
  78. package/build/_collections/utils/stack.util.spec.js +0 -290
  79. package/build/_collections/utils/stack.util.spec.js.map +0 -1
  80. package/build/_collections/utils/string-case.util.spec.d.ts +0 -2
  81. package/build/_collections/utils/string-case.util.spec.d.ts.map +0 -1
  82. package/build/_collections/utils/string-case.util.spec.js +0 -360
  83. package/build/_collections/utils/string-case.util.spec.js.map +0 -1
  84. package/build/_collections/utils/string.util.spec.d.ts +0 -2
  85. package/build/_collections/utils/string.util.spec.d.ts.map +0 -1
  86. package/build/_collections/utils/string.util.spec.js +0 -860
  87. package/build/_collections/utils/string.util.spec.js.map +0 -1
  88. package/build/_collections/utils/time.util.spec.d.ts +0 -2
  89. package/build/_collections/utils/time.util.spec.d.ts.map +0 -1
  90. package/build/_collections/utils/time.util.spec.js +0 -38
  91. package/build/_collections/utils/time.util.spec.js.map +0 -1
  92. package/build/_collections/utils/type-cloning-facility.util.spec.d.ts +0 -2
  93. package/build/_collections/utils/type-cloning-facility.util.spec.d.ts.map +0 -1
  94. package/build/_collections/utils/type-cloning-facility.util.spec.js +0 -41
  95. package/build/_collections/utils/type-cloning-facility.util.spec.js.map +0 -1
  96. package/build/_collections/utils/uuid.util.spec.d.ts +0 -2
  97. package/build/_collections/utils/uuid.util.spec.d.ts.map +0 -1
  98. package/build/_collections/utils/uuid.util.spec.js +0 -29
  99. package/build/_collections/utils/uuid.util.spec.js.map +0 -1
  100. package/build/_models/control-models/data-model-params.control-model.spec.d.ts +0 -2
  101. package/build/_models/control-models/data-model-params.control-model.spec.d.ts.map +0 -1
  102. package/build/_models/control-models/data-model-params.control-model.spec.js +0 -64
  103. package/build/_models/control-models/data-model-params.control-model.spec.js.map +0 -1
  104. package/build/_models/control-models/data-property-params.control-model.spec.d.ts +0 -2
  105. package/build/_models/control-models/data-property-params.control-model.spec.d.ts.map +0 -1
  106. package/build/_models/control-models/data-property-params.control-model.spec.js +0 -74
  107. package/build/_models/control-models/data-property-params.control-model.spec.js.map +0 -1
  108. package/build/_models/control-models/error.control-model.spec.d.ts +0 -2
  109. package/build/_models/control-models/error.control-model.spec.d.ts.map +0 -1
  110. package/build/_models/control-models/error.control-model.spec.js +0 -664
  111. package/build/_models/control-models/error.control-model.spec.js.map +0 -1
  112. package/build/_models/control-models/poll.control-model.spec.d.ts +0 -2
  113. package/build/_models/control-models/poll.control-model.spec.d.ts.map +0 -1
  114. package/build/_models/control-models/poll.control-model.spec.js +0 -57
  115. package/build/_models/control-models/poll.control-model.spec.js.map +0 -1
  116. package/build/_models/control-models/range-value.control-model.spec.d.ts +0 -2
  117. package/build/_models/control-models/range-value.control-model.spec.d.ts.map +0 -1
  118. package/build/_models/control-models/range-value.control-model.spec.js +0 -163
  119. package/build/_models/control-models/range-value.control-model.spec.js.map +0 -1
  120. package/build/_modules/crypto/_collections/crypto.util.edge.spec.d.ts +0 -2
  121. package/build/_modules/crypto/_collections/crypto.util.edge.spec.d.ts.map +0 -1
  122. package/build/_modules/crypto/_collections/crypto.util.edge.spec.js +0 -551
  123. package/build/_modules/crypto/_collections/crypto.util.edge.spec.js.map +0 -1
  124. package/build/_modules/crypto/_collections/crypto.util.extra.spec.d.ts +0 -2
  125. package/build/_modules/crypto/_collections/crypto.util.extra.spec.d.ts.map +0 -1
  126. package/build/_modules/crypto/_collections/crypto.util.extra.spec.js +0 -555
  127. package/build/_modules/crypto/_collections/crypto.util.extra.spec.js.map +0 -1
  128. package/build/_modules/crypto/_collections/crypto.util.simple.spec.d.ts +0 -2
  129. package/build/_modules/crypto/_collections/crypto.util.simple.spec.d.ts.map +0 -1
  130. package/build/_modules/crypto/_collections/crypto.util.simple.spec.js +0 -429
  131. package/build/_modules/crypto/_collections/crypto.util.simple.spec.js.map +0 -1
  132. package/build/_modules/custom-data/_models/cud.data-model.spec.d.ts +0 -2
  133. package/build/_modules/custom-data/_models/cud.data-model.spec.d.ts.map +0 -1
  134. package/build/_modules/custom-data/_models/cud.data-model.spec.js +0 -35
  135. package/build/_modules/custom-data/_models/cud.data-model.spec.js.map +0 -1
  136. package/build/_modules/location/_collections/loc-regions.util.spec.d.ts +0 -2
  137. package/build/_modules/location/_collections/loc-regions.util.spec.d.ts.map +0 -1
  138. package/build/_modules/location/_collections/loc-regions.util.spec.js +0 -51
  139. package/build/_modules/location/_collections/loc-regions.util.spec.js.map +0 -1
  140. package/build/_modules/location/_collections/loc.util.spec.d.ts +0 -2
  141. package/build/_modules/location/_collections/loc.util.spec.d.ts.map +0 -1
  142. package/build/_modules/location/_collections/loc.util.spec.js +0 -39
  143. package/build/_modules/location/_collections/loc.util.spec.js.map +0 -1
  144. package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.d.ts +0 -2
  145. package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.d.ts.map +0 -1
  146. package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.js +0 -33
  147. package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.js.map +0 -1
  148. package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.d.ts +0 -2
  149. package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.d.ts.map +0 -1
  150. package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.js +0 -36
  151. package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.js.map +0 -1
  152. package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.d.ts +0 -2
  153. package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.d.ts.map +0 -1
  154. package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.js +0 -35
  155. package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.js.map +0 -1
  156. package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.d.ts +0 -2
  157. package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.d.ts.map +0 -1
  158. package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.js +0 -31
  159. package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.js.map +0 -1
  160. package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.d.ts +0 -2
  161. package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.d.ts.map +0 -1
  162. package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.js +0 -54
  163. package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.js.map +0 -1
  164. package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.d.ts +0 -2
  165. package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.d.ts.map +0 -1
  166. package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.js +0 -26
  167. package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.js.map +0 -1
  168. package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.d.ts +0 -2
  169. package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.d.ts.map +0 -1
  170. package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.js +0 -50
  171. package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.js.map +0 -1
  172. package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.d.ts +0 -2
  173. package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.d.ts.map +0 -1
  174. package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.js +0 -23
  175. package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.js.map +0 -1
  176. package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.d.ts +0 -2
  177. package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.d.ts.map +0 -1
  178. package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.js +0 -38
  179. package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.js.map +0 -1
  180. package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.d.ts +0 -2
  181. package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.d.ts.map +0 -1
  182. package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.js +0 -20
  183. package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.js.map +0 -1
  184. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.d.ts +0 -2
  185. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.d.ts.map +0 -1
  186. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js +0 -50
  187. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js.map +0 -1
  188. package/build/_modules/socket/_models/sck-client-params.control-model.spec.d.ts +0 -2
  189. package/build/_modules/socket/_models/sck-client-params.control-model.spec.d.ts.map +0 -1
  190. package/build/_modules/socket/_models/sck-client-params.control-model.spec.js +0 -54
  191. package/build/_modules/socket/_models/sck-client-params.control-model.spec.js.map +0 -1
  192. package/build/_modules/socket/_models/sck-socket-event.control-model.spec.d.ts +0 -2
  193. package/build/_modules/socket/_models/sck-socket-event.control-model.spec.d.ts.map +0 -1
  194. package/build/_modules/socket/_models/sck-socket-event.control-model.spec.js +0 -49
  195. package/build/_modules/socket/_models/sck-socket-event.control-model.spec.js.map +0 -1
  196. package/build/_modules/socket/_services/sck-client.service-base.spec.d.ts +0 -2
  197. package/build/_modules/socket/_services/sck-client.service-base.spec.d.ts.map +0 -1
  198. package/build/_modules/socket/_services/sck-client.service-base.spec.js +0 -82
  199. package/build/_modules/socket/_services/sck-client.service-base.spec.js.map +0 -1
  200. package/build/_modules/usage/_models/usg-action.control-model.spec.d.ts +0 -2
  201. package/build/_modules/usage/_models/usg-action.control-model.spec.d.ts.map +0 -1
  202. package/build/_modules/usage/_models/usg-action.control-model.spec.js +0 -24
  203. package/build/_modules/usage/_models/usg-action.control-model.spec.js.map +0 -1
  204. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.d.ts +0 -2
  205. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.d.ts.map +0 -1
  206. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.js +0 -33
  207. package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.js.map +0 -1
  208. package/build/_modules/usage/_models/usg-data.control-model.spec.d.ts +0 -2
  209. package/build/_modules/usage/_models/usg-data.control-model.spec.d.ts.map +0 -1
  210. package/build/_modules/usage/_models/usg-data.control-model.spec.js +0 -37
  211. package/build/_modules/usage/_models/usg-data.control-model.spec.js.map +0 -1
  212. package/build/_modules/usage/_models/usg-session.data-model.spec.d.ts +0 -2
  213. package/build/_modules/usage/_models/usg-session.data-model.spec.d.ts.map +0 -1
  214. package/build/_modules/usage/_models/usg-session.data-model.spec.js +0 -82
  215. package/build/_modules/usage/_models/usg-session.data-model.spec.js.map +0 -1
  216. package/futdevpro-fsm-dynamo-01.15.01.tgz +0 -0
@@ -1,860 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const string_util_1 = require("./string.util");
4
- describe('| DyFM_String', () => {
5
- describe('| breakTrim', () => {
6
- it('| should remove spaces from the start and end of the string', () => {
7
- const result = string_util_1.DyFM_String.breakTrim(' hello world ');
8
- expect(result).toBe('hello world');
9
- });
10
- it('| should remove newline characters from the start and end of the string', () => {
11
- const result = string_util_1.DyFM_String.breakTrim('\nhello world\n');
12
- expect(result).toBe('hello world');
13
- });
14
- it('| should remove carriage return characters from the start and end of the string', () => {
15
- const result = string_util_1.DyFM_String.breakTrim('\rhello world\r');
16
- expect(result).toBe('hello world');
17
- });
18
- it('| should remove all types of line breaks from the start and end of the string', () => {
19
- const result = string_util_1.DyFM_String.breakTrim('\r\nhello world\r\n');
20
- expect(result).toBe('hello world');
21
- });
22
- it('| should return an empty string if the input is only spaces and line breaks', () => {
23
- const result = string_util_1.DyFM_String.breakTrim(' \r\n ');
24
- expect(result).toBe('');
25
- });
26
- it('| should not alter a string that has no spaces or line breaks at the start or end', () => {
27
- const result = string_util_1.DyFM_String.breakTrim('hello world');
28
- expect(result).toBe('hello world');
29
- });
30
- it('| should handle an empty string input', () => {
31
- const result = string_util_1.DyFM_String.breakTrim('');
32
- expect(result).toBe('');
33
- });
34
- });
35
- describe('| nestedBracketSplit', () => {
36
- it('| should handle simple bracket extraction with replacement', () => {
37
- const input = 'hello (world) test';
38
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '...');
39
- expect(result).toEqual(['hello ... test', 'world']);
40
- });
41
- it('| should handle multiple brackets at the same level', () => {
42
- const input = 'start (first) middle (second) end';
43
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '...');
44
- expect(result).toEqual(['start ... middle ... end', 'first', 'second']);
45
- });
46
- it('| should handle nested brackets according to the example', () => {
47
- const input = 'asdasd (and other things) around (and layered things (and more layers) around) around';
48
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 2, '...');
49
- expect(result).toEqual([
50
- 'asdasd ... around ... around',
51
- 'and other things',
52
- 'and layered things ... around',
53
- 'and more layers'
54
- ]);
55
- });
56
- it('| should respect maxDepth parameter', () => {
57
- const input = 'text (level1 (level2 (level3) level2) level1) text';
58
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 1, '...');
59
- expect(result).toEqual([
60
- 'text ... text',
61
- 'level1 (level2 (level3) level2) level1'
62
- ]);
63
- });
64
- it('| should handle empty replacement string', () => {
65
- const input = 'hello (world) test';
66
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '');
67
- expect(result).toEqual(['hello test', 'world']);
68
- });
69
- it('| should handle string with no brackets', () => {
70
- const input = 'hello world test';
71
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '...');
72
- expect(result).toEqual(['hello world test']);
73
- });
74
- it('| should handle empty string', () => {
75
- const input = '';
76
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '...');
77
- expect(result).toEqual(['']);
78
- });
79
- it('| should handle unmatched opening bracket', () => {
80
- const input = 'hello (world test';
81
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '...');
82
- expect(result).toEqual(['hello (world test']);
83
- });
84
- it('| should handle unmatched closing bracket', () => {
85
- const input = 'hello world) test';
86
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '...');
87
- expect(result).toEqual(['hello world) test']);
88
- });
89
- it('| should handle custom bracket characters', () => {
90
- const input = 'start [first] middle [second] end';
91
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '[', ']', 10, '...');
92
- expect(result).toEqual(['start ... middle ... end', 'first', 'second']);
93
- });
94
- it('| should handle multi-character brackets', () => {
95
- const input = 'start {{first}} middle {{second}} end';
96
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '{{', '}}', 10, '...');
97
- expect(result).toEqual(['start ... middle ... end', 'first', 'second']);
98
- });
99
- it('| should handle deeply nested brackets with maxDepth', () => {
100
- const input = 'text (a (b (c (d) c) b) a) text';
101
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 3, '...');
102
- expect(result).toEqual([
103
- 'text ... text',
104
- 'a ... a',
105
- 'b ... b',
106
- 'c (d) c'
107
- ]);
108
- });
109
- it('| should handle same character for opening and closing bracket', () => {
110
- const input = "start 'first quote' middle 'second quote' end";
111
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 10, '...');
112
- expect(result).toEqual(["start ... middle ... end", 'first quote', 'second quote']);
113
- });
114
- it('| should handle nested same character brackets', () => {
115
- const input = "text 'outer 'inner' outer' text";
116
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 2, '...');
117
- expect(result).toEqual([
118
- 'text ... text',
119
- 'outer ... outer',
120
- 'inner'
121
- ]);
122
- });
123
- it('| should handle multiple levels of same character brackets', () => {
124
- const input = "start 'level1 'level2 'level3' level2' level1' end";
125
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 3, '...');
126
- expect(result).toEqual([
127
- 'start ... end',
128
- 'level1 ... level1',
129
- 'level2 ... level2',
130
- 'level3'
131
- ]);
132
- });
133
- it('| should handle empty content between same character brackets', () => {
134
- const input = "text '' more text";
135
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 10, '...');
136
- expect(result).toEqual(['text ... more text', '']);
137
- });
138
- it('| should handle single same character bracket (unmatched)', () => {
139
- const input = "text 'unmatched quote";
140
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 10, '...');
141
- expect(result).toEqual(["text 'unmatched quote"]);
142
- });
143
- it('| should handle alternating same character brackets', () => {
144
- const input = "text 'first' normal 'second' normal 'third' text";
145
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 10, '...');
146
- expect(result).toEqual(['text ... normal ... normal ... text', 'first', 'second', 'third']);
147
- });
148
- it('| should respect maxDepth with same character brackets', () => {
149
- const input = "text 'a 'b 'c' b' a' text";
150
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, "'", "'", 1, '...');
151
- expect(result).toEqual([
152
- 'text ... text',
153
- "a 'b 'c' b' a"
154
- ]);
155
- });
156
- });
157
- describe('| nestedBracketSplit - replaceContents variations', () => {
158
- it('| should handle empty replaceContents (no replacement)', () => {
159
- const input = 'hello (world) test';
160
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '');
161
- expect(result).toEqual(['hello test', 'world']);
162
- });
163
- it('| should handle undefined replaceContents (no replacement)', () => {
164
- const input = 'hello (world) test';
165
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10);
166
- expect(result).toEqual(['hello (world) test', 'world']);
167
- });
168
- it('| should handle multiple brackets with empty replaceContents', () => {
169
- const input = 'start (first) middle (second) end';
170
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 10, '');
171
- expect(result).toEqual(['start middle end', 'first', 'second']);
172
- });
173
- it('| should handle nested brackets with empty replaceContents', () => {
174
- const input = 'text (outer (inner) outer) text';
175
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 2, '');
176
- expect(result).toEqual(['text text', 'outer outer', 'inner']);
177
- });
178
- });
179
- describe('| nestedBracketSplitDetailed', () => {
180
- it('| should return detailed information for simple nested brackets', () => {
181
- const input = 'hello (world) test';
182
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 10, '...');
183
- expect(result).toEqual([
184
- { content: 'hello ... test', level: 0, brackets: null },
185
- { content: 'world', level: 1, brackets: { opening: '(', closing: ')' } }
186
- ]);
187
- });
188
- it('| should handle nested brackets with detailed level information', () => {
189
- const input = 'asdasd (and other things) around (and layered things (and more layers) around) around';
190
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 2, '...');
191
- expect(result).toEqual([
192
- { content: 'asdasd ... around ... around', level: 0, brackets: null },
193
- { content: 'and other things', level: 1, brackets: { opening: '(', closing: ')' } },
194
- { content: 'and layered things ... around', level: 1, brackets: { opening: '(', closing: ')' } },
195
- { content: 'and more layers', level: 2, brackets: { opening: '(', closing: ')' } }
196
- ]);
197
- });
198
- it('| should handle same character brackets with detailed info', () => {
199
- const input = "text 'quoted content' end";
200
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, "'", "'", 10, '...');
201
- expect(result).toEqual([
202
- { content: 'text ... end', level: 0, brackets: null },
203
- { content: 'quoted content', level: 1, brackets: { opening: "'", closing: "'" } }
204
- ]);
205
- });
206
- it('| should respect maxDepth with detailed levels', () => {
207
- const input = 'text (a (b (c) b) a) text';
208
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 2, '...');
209
- expect(result).toEqual([
210
- { content: 'text ... text', level: 0, brackets: null },
211
- { content: 'a ... a', level: 1, brackets: { opening: '(', closing: ')' } },
212
- { content: 'b (c) b', level: 2, brackets: { opening: '(', closing: ')' } }
213
- ]);
214
- });
215
- it('| should handle no brackets case', () => {
216
- const input = 'plain text with no brackets';
217
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 10, '...');
218
- expect(result).toEqual([
219
- { content: 'plain text with no brackets', level: 0, brackets: null }
220
- ]);
221
- });
222
- it('| should handle empty replaceContents (no replacement)', () => {
223
- const input = 'hello (world) test';
224
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 10, '');
225
- expect(result).toEqual([
226
- { content: 'hello test', level: 0, brackets: null },
227
- { content: 'world', level: 1, brackets: { opening: '(', closing: ')' } }
228
- ]);
229
- });
230
- it('| should handle undefined replaceContents (no replacement)', () => {
231
- const input = 'hello (world) test';
232
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 10);
233
- expect(result).toEqual([
234
- { content: 'hello (world) test', level: 0, brackets: null },
235
- { content: 'world', level: 1, brackets: { opening: '(', closing: ')' } }
236
- ]);
237
- });
238
- it('| should handle nested brackets with empty replaceContents', () => {
239
- const input = 'text (outer (inner) outer) text';
240
- const result = string_util_1.DyFM_String.nestedBracketSplitDetailed(input, '(', ')', 2, '');
241
- expect(result).toEqual([
242
- { content: 'text text', level: 0, brackets: null },
243
- { content: 'outer outer', level: 1, brackets: { opening: '(', closing: ')' } },
244
- { content: 'inner', level: 2, brackets: { opening: '(', closing: ')' } }
245
- ]);
246
- });
247
- });
248
- describe('| multiBracketSplit', () => {
249
- const standardBrackets = [
250
- { opening: '(', closing: ')' },
251
- { opening: '[', closing: ']' },
252
- { opening: '{', closing: '}' }
253
- ];
254
- it('| should handle multiple bracket types at the same level', () => {
255
- const input = 'text (round) and [square] with {curly} brackets';
256
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '...');
257
- expect(result).toEqual([
258
- 'text ... and ... with ... brackets',
259
- 'round',
260
- 'square',
261
- 'curly'
262
- ]);
263
- });
264
- it('| should handle mixed nested brackets according to the example', () => {
265
- const input = 'text (round) and [square] with {curly (nested)} brackets';
266
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 2, '...');
267
- expect(result).toEqual([
268
- 'text ... and ... with ... brackets',
269
- 'round',
270
- 'square',
271
- 'curly ...',
272
- 'nested'
273
- ]);
274
- });
275
- it('| should handle deeply nested mixed brackets', () => {
276
- const input = 'start {outer [middle (inner) middle] outer} end';
277
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 3, '...');
278
- expect(result).toEqual([
279
- 'start ... end',
280
- 'outer ... outer',
281
- 'middle ... middle',
282
- 'inner'
283
- ]);
284
- });
285
- it('| should respect maxDepth with mixed brackets', () => {
286
- const input = 'text {a [b (c) b] a} text';
287
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 1, '...');
288
- expect(result).toEqual([
289
- 'text ... text',
290
- 'a [b (c) b] a'
291
- ]);
292
- });
293
- it('| should handle empty bracket contents', () => {
294
- const input = 'text () and [] with {} brackets';
295
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '...');
296
- expect(result).toEqual([
297
- 'text ... and ... with ... brackets',
298
- '',
299
- '',
300
- ''
301
- ]);
302
- });
303
- it('| should handle unmatched brackets gracefully', () => {
304
- const input = 'text (unmatched and [incomplete';
305
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '...');
306
- expect(result).toEqual(['text (unmatched and [incomplete']);
307
- });
308
- it('| should handle same character brackets in the array', () => {
309
- const quoteBrackets = [
310
- { opening: "'", closing: "'" },
311
- { opening: '"', closing: '"' }
312
- ];
313
- const input = "text 'single quoted' and \"double quoted\" content";
314
- const result = string_util_1.DyFM_String.multiBracketSplit(input, quoteBrackets, 10, '...');
315
- expect(result).toEqual([
316
- 'text ... and ... content',
317
- 'single quoted',
318
- 'double quoted'
319
- ]);
320
- });
321
- it('| should handle multi-character brackets', () => {
322
- const customBrackets = [
323
- { opening: '{{', closing: '}}' },
324
- { opening: '[[', closing: ']]' },
325
- { opening: '()', closing: ')(' }
326
- ];
327
- const input = 'text {{double curly}} and [[double square]] with ()reversed)( brackets';
328
- const result = string_util_1.DyFM_String.multiBracketSplit(input, customBrackets, 10, '...');
329
- expect(result).toEqual([
330
- 'text ... and ... with ... brackets',
331
- 'double curly',
332
- 'double square',
333
- 'reversed'
334
- ]);
335
- });
336
- it('| should handle complex nesting with different bracket types', () => {
337
- const input = 'start (round [square {curly [inner]} square] round) end';
338
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 4, '...');
339
- expect(result).toEqual([
340
- 'start ... end',
341
- 'round ... round',
342
- 'square ... square',
343
- 'curly ...',
344
- 'inner'
345
- ]);
346
- });
347
- it('| should handle no brackets', () => {
348
- const input = 'plain text with no brackets';
349
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '...');
350
- expect(result).toEqual(['plain text with no brackets']);
351
- });
352
- it('| should handle empty string', () => {
353
- const input = '';
354
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '...');
355
- expect(result).toEqual(['']);
356
- });
357
- it('| should handle empty brackets array', () => {
358
- const input = 'text (with) brackets [but] no {bracket} definitions';
359
- const result = string_util_1.DyFM_String.multiBracketSplit(input, [], 10, '...');
360
- expect(result).toEqual(['text (with) brackets [but] no {bracket} definitions']);
361
- });
362
- it('| should handle overlapping bracket patterns', () => {
363
- const overlappingBrackets = [
364
- { opening: '(', closing: ')' },
365
- { opening: '((', closing: '))' }
366
- ];
367
- const input = 'text ((double)) and (single) brackets';
368
- const result = string_util_1.DyFM_String.multiBracketSplit(input, overlappingBrackets, 10, '...');
369
- expect(result).toEqual([
370
- 'text ... and ... brackets',
371
- 'double',
372
- 'single'
373
- ]);
374
- });
375
- it('| should handle brackets with same opening but different closing', () => {
376
- const mixedBrackets = [
377
- { opening: '<', closing: '>' },
378
- { opening: '<', closing: '/>' }
379
- ];
380
- const input = 'text <tag/> and <content> here';
381
- const result = string_util_1.DyFM_String.multiBracketSplit(input, mixedBrackets, 10, '...');
382
- expect(result).toEqual([
383
- 'text ... and ... here',
384
- 'tag',
385
- 'content'
386
- ]);
387
- });
388
- it('| should maintain proper bracket matching with mixed types', () => {
389
- const input = 'text (round [square) wrong] correct';
390
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '...');
391
- expect(result).toEqual([
392
- 'text ... wrong] correct',
393
- 'round [square'
394
- ]);
395
- });
396
- });
397
- describe('| multiBracketSplit - replaceContents variations', () => {
398
- const standardBrackets = [
399
- { opening: '(', closing: ')' },
400
- { opening: '[', closing: ']' },
401
- { opening: '{', closing: '}' }
402
- ];
403
- it('| should handle empty replaceContents (no replacement)', () => {
404
- const input = 'text (round) and [square] with {curly} brackets';
405
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10, '');
406
- expect(result).toEqual([
407
- 'text and with brackets',
408
- 'round',
409
- 'square',
410
- 'curly'
411
- ]);
412
- });
413
- it('| should handle undefined replaceContents (no replacement)', () => {
414
- const input = 'text (round) and [square] with {curly} brackets';
415
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 10);
416
- expect(result).toEqual([
417
- 'text (round) and [square] with {curly} brackets',
418
- 'round',
419
- 'square',
420
- 'curly'
421
- ]);
422
- });
423
- it('| should handle nested brackets with empty replaceContents', () => {
424
- const input = 'text (round) and [square] with {curly (nested)} brackets';
425
- const result = string_util_1.DyFM_String.multiBracketSplit(input, standardBrackets, 2, '');
426
- expect(result).toEqual([
427
- 'text and with brackets',
428
- 'round',
429
- 'square',
430
- 'curly ',
431
- 'nested'
432
- ]);
433
- });
434
- });
435
- describe('| multiBracketSplitDetailed', () => {
436
- const standardBrackets = [
437
- { opening: '(', closing: ')' },
438
- { opening: '[', closing: ']' },
439
- { opening: '{', closing: '}' }
440
- ];
441
- it('| should return detailed information for simple bracket extraction', () => {
442
- const input = 'text (round) end';
443
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10, '...');
444
- expect(result).toEqual([
445
- { content: 'text ... end', level: 0, brackets: null },
446
- { content: 'round', level: 1, brackets: { opening: '(', closing: ')' } }
447
- ]);
448
- });
449
- it('| should handle multiple bracket types with detailed info', () => {
450
- const input = 'text (round) and [square] with {curly} brackets';
451
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10, '...');
452
- expect(result).toEqual([
453
- { content: 'text ... and ... with ... brackets', level: 0, brackets: null },
454
- { content: 'round', level: 1, brackets: { opening: '(', closing: ')' } },
455
- { content: 'square', level: 1, brackets: { opening: '[', closing: ']' } },
456
- { content: 'curly', level: 1, brackets: { opening: '{', closing: '}' } }
457
- ]);
458
- });
459
- it('| should handle nested brackets with detailed level information', () => {
460
- const input = 'text (round) and [square] with {curly (nested)} brackets';
461
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 2, '...');
462
- expect(result).toEqual([
463
- { content: 'text ... and ... with ... brackets', level: 0, brackets: null },
464
- { content: 'round', level: 1, brackets: { opening: '(', closing: ')' } },
465
- { content: 'square', level: 1, brackets: { opening: '[', closing: ']' } },
466
- { content: 'curly ...', level: 1, brackets: { opening: '{', closing: '}' } },
467
- { content: 'nested', level: 2, brackets: { opening: '(', closing: ')' } }
468
- ]);
469
- });
470
- it('| should handle deeply nested brackets with correct levels', () => {
471
- const input = 'start {outer [middle (inner) middle] outer} end';
472
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 3, '...');
473
- expect(result).toEqual([
474
- { content: 'start ... end', level: 0, brackets: null },
475
- { content: 'outer ... outer', level: 1, brackets: { opening: '{', closing: '}' } },
476
- { content: 'middle ... middle', level: 2, brackets: { opening: '[', closing: ']' } },
477
- { content: 'inner', level: 3, brackets: { opening: '(', closing: ')' } }
478
- ]);
479
- });
480
- it('| should respect maxDepth and show correct levels', () => {
481
- const input = 'text {a [b (c) b] a} text';
482
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 2, '...');
483
- expect(result).toEqual([
484
- { content: 'text ... text', level: 0, brackets: null },
485
- { content: 'a ... a', level: 1, brackets: { opening: '{', closing: '}' } },
486
- { content: 'b (c) b', level: 2, brackets: { opening: '[', closing: ']' } }
487
- ]);
488
- });
489
- it('| should handle empty brackets with detailed info', () => {
490
- const input = 'text () and [] with {} brackets';
491
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10, '...');
492
- expect(result).toEqual([
493
- { content: 'text ... and ... with ... brackets', level: 0, brackets: null },
494
- { content: '', level: 1, brackets: { opening: '(', closing: ')' } },
495
- { content: '', level: 1, brackets: { opening: '[', closing: ']' } },
496
- { content: '', level: 1, brackets: { opening: '{', closing: '}' } }
497
- ]);
498
- });
499
- it('| should handle custom bracket types with detailed info', () => {
500
- const customBrackets = [
501
- { opening: '{{', closing: '}}' },
502
- { opening: '[[', closing: ']]' }
503
- ];
504
- const input = 'text {{double curly}} and [[double square]] content';
505
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, customBrackets, 10, '...');
506
- expect(result).toEqual([
507
- { content: 'text ... and ... content', level: 0, brackets: null },
508
- { content: 'double curly', level: 1, brackets: { opening: '{{', closing: '}}' } },
509
- { content: 'double square', level: 1, brackets: { opening: '[[', closing: ']]' } }
510
- ]);
511
- });
512
- it('| should handle same character brackets with detailed info', () => {
513
- const quoteBrackets = [
514
- { opening: "'", closing: "'" },
515
- { opening: '"', closing: '"' }
516
- ];
517
- const input = "text 'single quoted' and \"double quoted\" content";
518
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, quoteBrackets, 10, '...');
519
- expect(result).toEqual([
520
- { content: 'text ... and ... content', level: 0, brackets: null },
521
- { content: 'single quoted', level: 1, brackets: { opening: "'", closing: "'" } },
522
- { content: 'double quoted', level: 1, brackets: { opening: '"', closing: '"' } }
523
- ]);
524
- });
525
- it('| should handle no brackets case', () => {
526
- const input = 'plain text with no brackets';
527
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10, '...');
528
- expect(result).toEqual([
529
- { content: 'plain text with no brackets', level: 0, brackets: null }
530
- ]);
531
- });
532
- it('| should handle empty brackets array', () => {
533
- const input = 'text (with) brackets [but] no {bracket} definitions';
534
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, [], 10, '...');
535
- expect(result).toEqual([
536
- { content: 'text (with) brackets [but] no {bracket} definitions', level: 0, brackets: null }
537
- ]);
538
- });
539
- it('| should handle empty string', () => {
540
- const input = '';
541
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10, '...');
542
- expect(result).toEqual([
543
- { content: '', level: 0, brackets: null }
544
- ]);
545
- });
546
- it('| should show bracket type for each extracted content', () => {
547
- const mixedBrackets = [
548
- { opening: '<', closing: '>' },
549
- { opening: '(', closing: ')' },
550
- { opening: '[', closing: ']' }
551
- ];
552
- const input = 'start <tag> middle (paren) end [array] finish';
553
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, mixedBrackets, 10, '...');
554
- expect(result).toEqual([
555
- { content: 'start ... middle ... end ... finish', level: 0, brackets: null },
556
- { content: 'tag', level: 1, brackets: { opening: '<', closing: '>' } },
557
- { content: 'paren', level: 1, brackets: { opening: '(', closing: ')' } },
558
- { content: 'array', level: 1, brackets: { opening: '[', closing: ']' } }
559
- ]);
560
- });
561
- it('| should handle complex nested scenario with multiple bracket types', () => {
562
- const input = 'text (a [b {c (d) c} b] a) text';
563
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 4, '...');
564
- expect(result).toEqual([
565
- { content: 'text ... text', level: 0, brackets: null },
566
- { content: 'a ... a', level: 1, brackets: { opening: '(', closing: ')' } },
567
- { content: 'b ... b', level: 2, brackets: { opening: '[', closing: ']' } },
568
- { content: 'c ... c', level: 3, brackets: { opening: '{', closing: '}' } },
569
- { content: 'd', level: 4, brackets: { opening: '(', closing: ')' } }
570
- ]);
571
- });
572
- });
573
- describe('| multiBracketSplitDetailed - replaceContents variations', () => {
574
- const standardBrackets = [
575
- { opening: '(', closing: ')' },
576
- { opening: '[', closing: ']' },
577
- { opening: '{', closing: '}' }
578
- ];
579
- it('| should handle empty replaceContents (no replacement)', () => {
580
- const input = 'text (round) and [square] brackets';
581
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10, '');
582
- expect(result).toEqual([
583
- { content: 'text and brackets', level: 0, brackets: null },
584
- { content: 'round', level: 1, brackets: { opening: '(', closing: ')' } },
585
- { content: 'square', level: 1, brackets: { opening: '[', closing: ']' } }
586
- ]);
587
- });
588
- it('| should handle undefined replaceContents (no replacement)', () => {
589
- const input = 'text (round) and [square] brackets';
590
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 10);
591
- expect(result).toEqual([
592
- { content: 'text (round) and [square] brackets', level: 0, brackets: null },
593
- { content: 'round', level: 1, brackets: { opening: '(', closing: ')' } },
594
- { content: 'square', level: 1, brackets: { opening: '[', closing: ']' } }
595
- ]);
596
- });
597
- it('| should handle nested brackets with empty replaceContents', () => {
598
- const input = 'text {curly (nested) content} end';
599
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, standardBrackets, 2, '');
600
- expect(result).toEqual([
601
- { content: 'text end', level: 0, brackets: null },
602
- { content: 'curly content', level: 1, brackets: { opening: '{', closing: '}' } },
603
- { content: 'nested', level: 2, brackets: { opening: '(', closing: ')' } }
604
- ]);
605
- });
606
- });
607
- // JSON and code fence extraction tests
608
- describe('| JSON and code fence extraction', () => {
609
- it('| should extract from plain JSON object with nested object', () => {
610
- const brackets = [
611
- { opening: '{', closing: '}' }
612
- ];
613
- const input = 'before {"name":"John","age":30,"nested":{"flag":true}} after';
614
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 3, '...');
615
- expect(result).toEqual([
616
- { content: 'before ... after', level: 0, brackets: null },
617
- { content: '"name":"John","age":30,"nested":...', level: 1, brackets: { opening: '{', closing: '}' } },
618
- { content: '"flag":true', level: 2, brackets: { opening: '{', closing: '}' } }
619
- ]);
620
- });
621
- it('| should extract JSON inside code fence json``` ... ```', () => {
622
- const brackets = [
623
- { opening: 'json```', closing: '```' },
624
- { opening: '{', closing: '}' }
625
- ];
626
- const input = 'pre json```{"x":1,"y":{"z":2}}``` post';
627
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 3, '...');
628
- expect(result).toEqual([
629
- { content: 'pre ... post', level: 0, brackets: null },
630
- { content: '...', level: 1, brackets: { opening: 'json```', closing: '```' } },
631
- { content: '"x":1,"y":...', level: 2, brackets: { opening: '{', closing: '}' } },
632
- { content: '"z":2', level: 3, brackets: { opening: '{', closing: '}' } }
633
- ]);
634
- });
635
- it('| should handle deeply nested JSON object within a property', () => {
636
- const brackets = [
637
- { opening: '{', closing: '}' }
638
- ];
639
- const input = 'wrap {"outer":{"mid":{"inner":42}}} done';
640
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 3, '...');
641
- expect(result).toEqual([
642
- { content: 'wrap ... done', level: 0, brackets: null },
643
- { content: '"outer":...', level: 1, brackets: { opening: '{', closing: '}' } },
644
- { content: '"mid":...', level: 2, brackets: { opening: '{', closing: '}' } },
645
- { content: '"inner":42', level: 3, brackets: { opening: '{', closing: '}' } }
646
- ]);
647
- });
648
- it('| should process when a JSON string value contains code fence pattern json``` ... ```', () => {
649
- const brackets = [
650
- { opening: 'json```', closing: '```' },
651
- { opening: '{', closing: '}' }
652
- ];
653
- const input = 'before {"note":"see json```X``` inside","data":{"raw":"json```Y```"}} after';
654
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 4, '...');
655
- expect(result).toEqual([
656
- { content: 'before ... after', level: 0, brackets: null },
657
- { content: '"note":"see ... inside","data":...', level: 1, brackets: { opening: '{', closing: '}' } },
658
- { content: 'X', level: 2, brackets: { opening: 'json```', closing: '```' } },
659
- { content: '"raw":"..."', level: 2, brackets: { opening: '{', closing: '}' } },
660
- { content: 'Y', level: 3, brackets: { opening: 'json```', closing: '```' } }
661
- ]);
662
- });
663
- });
664
- // Script/method extraction tests
665
- describe('| script/method extraction', () => {
666
- it('| should extract simple method arguments with parentheses', () => {
667
- const input = 'prefix doSomething(arg1, arg2) suffix';
668
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 2, '...');
669
- expect(result).toEqual([
670
- 'prefix doSomething... suffix',
671
- 'arg1, arg2'
672
- ]);
673
- });
674
- it('| should handle nested method calls', () => {
675
- const input = 'call outer(inner(a, b), c)';
676
- const result = string_util_1.DyFM_String.nestedBracketSplit(input, '(', ')', 3, '...');
677
- expect(result).toEqual([
678
- 'call outer...',
679
- 'inner..., c',
680
- 'a, b'
681
- ]);
682
- });
683
- it('| should extract quoted args inside a method call', () => {
684
- const brackets = [
685
- { opening: '(', closing: ')' },
686
- { opening: '"', closing: '"' }
687
- ];
688
- const input = 'run fn("a, b", 3) end';
689
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 3, '...');
690
- expect(result).toEqual([
691
- { content: 'run fn... end', level: 0, brackets: null },
692
- { content: '..., 3', level: 1, brackets: { opening: '(', closing: ')' } },
693
- { content: 'a, b', level: 2, brackets: { opening: '"', closing: '"' } }
694
- ]);
695
- });
696
- it('| should handle JSON literal and inner helper call as arguments', () => {
697
- const brackets = [
698
- { opening: '(', closing: ')' },
699
- { opening: '{', closing: '}' },
700
- { opening: '"', closing: '"' }
701
- ];
702
- const input = 'call api({id:1, meta:{ok:true}}, helper("x")) done';
703
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 4, '...');
704
- expect(result).toEqual([
705
- { content: 'call api... done', level: 0, brackets: null },
706
- { content: '..., helper...', level: 1, brackets: { opening: '(', closing: ')' } },
707
- { content: 'id:1, meta:...', level: 2, brackets: { opening: '{', closing: '}' } },
708
- { content: '...', level: 2, brackets: { opening: '(', closing: ')' } },
709
- { content: 'ok:true', level: 3, brackets: { opening: '{', closing: '}' } },
710
- { content: 'x', level: 3, brackets: { opening: '"', closing: '"' } }
711
- ]);
712
- });
713
- it('| should process code fence marker inside a quoted argument', () => {
714
- const brackets = [
715
- { opening: '(', closing: ')' },
716
- { opening: 'json```', closing: '```' },
717
- { opening: '"', closing: '"' }
718
- ];
719
- const input = 'run method("see json```{a:1}``` here", 0)';
720
- const result = string_util_1.DyFM_String.multiBracketSplitDetailed(input, brackets, 4, '...');
721
- expect(result).toEqual([
722
- { content: 'run method...', level: 0, brackets: null },
723
- { content: '..., 0', level: 1, brackets: { opening: '(', closing: ')' } },
724
- { content: 'see ... here', level: 2, brackets: { opening: '"', closing: '"' } },
725
- { content: '{a:1}', level: 3, brackets: { opening: 'json```', closing: '```' } }
726
- ]);
727
- });
728
- });
729
- describe('| anyNameToShortCode', () => {
730
- it('| should convert space-separated name to short code', () => {
731
- const result = string_util_1.DyFM_String.anyNameToShortCode('John Doe');
732
- expect(result).toBe('JD');
733
- });
734
- it('| should convert camelCase name to short code', () => {
735
- const result = string_util_1.DyFM_String.anyNameToShortCode('JohnDoe');
736
- expect(result).toBe('JD');
737
- });
738
- it('| should convert underscore-separated name to short code', () => {
739
- const result = string_util_1.DyFM_String.anyNameToShortCode('John_Doe');
740
- expect(result).toBe('JD');
741
- });
742
- it('| should convert camelCase starting with lowercase to short code', () => {
743
- const result = string_util_1.DyFM_String.anyNameToShortCode('johnDoe');
744
- expect(result).toBe('JD');
745
- });
746
- it('| should convert lowercase underscore-separated name to short code', () => {
747
- const result = string_util_1.DyFM_String.anyNameToShortCode('john_doe');
748
- expect(result).toBe('JD');
749
- });
750
- it('| should convert hyphen-separated name to short code', () => {
751
- const result = string_util_1.DyFM_String.anyNameToShortCode('john-doe');
752
- expect(result).toBe('JD');
753
- });
754
- it('| should handle single word name', () => {
755
- const result = string_util_1.DyFM_String.anyNameToShortCode('John');
756
- expect(result).toBe('J');
757
- });
758
- it('| should handle single lowercase word', () => {
759
- const result = string_util_1.DyFM_String.anyNameToShortCode('john');
760
- expect(result).toBe('J');
761
- });
762
- it('| should handle three words', () => {
763
- const result = string_util_1.DyFM_String.anyNameToShortCode('John Michael Doe');
764
- expect(result).toBe('JMD');
765
- });
766
- it('| should handle mixed separators', () => {
767
- const result = string_util_1.DyFM_String.anyNameToShortCode('John_Michael-Doe');
768
- expect(result).toBe('JMD');
769
- });
770
- it('| should handle camelCase with multiple words', () => {
771
- const result = string_util_1.DyFM_String.anyNameToShortCode('JohnMichaelDoe');
772
- expect(result).toBe('JMD');
773
- });
774
- it('| should handle mixed camelCase and separators', () => {
775
- const result = string_util_1.DyFM_String.anyNameToShortCode('JohnMichael_Doe');
776
- expect(result).toBe('JMD');
777
- });
778
- it('| should handle name with multiple spaces', () => {
779
- const result = string_util_1.DyFM_String.anyNameToShortCode('John Doe');
780
- expect(result).toBe('JD');
781
- });
782
- it('| should handle name with multiple underscores', () => {
783
- const result = string_util_1.DyFM_String.anyNameToShortCode('John___Doe');
784
- expect(result).toBe('JD');
785
- });
786
- it('| should handle name with multiple hyphens', () => {
787
- const result = string_util_1.DyFM_String.anyNameToShortCode('John---Doe');
788
- expect(result).toBe('JD');
789
- });
790
- it('| should handle name with mixed separators and spaces', () => {
791
- const result = string_util_1.DyFM_String.anyNameToShortCode('John _- Doe');
792
- expect(result).toBe('JD');
793
- });
794
- it('| should handle empty string', () => {
795
- const result = string_util_1.DyFM_String.anyNameToShortCode('');
796
- expect(result).toBe('');
797
- });
798
- it('| should handle string with only spaces', () => {
799
- const result = string_util_1.DyFM_String.anyNameToShortCode(' ');
800
- expect(result).toBe('');
801
- });
802
- it('| should handle string with only separators', () => {
803
- const result = string_util_1.DyFM_String.anyNameToShortCode('___---');
804
- expect(result).toBe('');
805
- });
806
- it('| should handle name with leading and trailing spaces', () => {
807
- const result = string_util_1.DyFM_String.anyNameToShortCode(' John Doe ');
808
- expect(result).toBe('JD');
809
- });
810
- it('| should handle name with leading and trailing separators', () => {
811
- const result = string_util_1.DyFM_String.anyNameToShortCode('_John_Doe_');
812
- expect(result).toBe('JD');
813
- });
814
- it('| should handle all uppercase name', () => {
815
- const result = string_util_1.DyFM_String.anyNameToShortCode('JOHN DOE');
816
- expect(result).toBe('JD');
817
- });
818
- it('| should handle all uppercase camelCase', () => {
819
- const result = string_util_1.DyFM_String.anyNameToShortCode('JOHNDOE');
820
- expect(result).toBe('J');
821
- });
822
- it('| should handle name with numbers', () => {
823
- const result = string_util_1.DyFM_String.anyNameToShortCode('John2 Doe3');
824
- expect(result).toBe('JD');
825
- });
826
- it('| should handle name starting with number', () => {
827
- const result = string_util_1.DyFM_String.anyNameToShortCode('2John Doe');
828
- expect(result).toBe('JD');
829
- });
830
- it('| should handle complex camelCase with numbers', () => {
831
- const result = string_util_1.DyFM_String.anyNameToShortCode('john2Doe3Smith');
832
- expect(result).toBe('JDS');
833
- });
834
- it('| should handle single character', () => {
835
- const result = string_util_1.DyFM_String.anyNameToShortCode('J');
836
- expect(result).toBe('J');
837
- });
838
- it('| should handle name with special characters', () => {
839
- const result = string_util_1.DyFM_String.anyNameToShortCode('John@Doe#Smith');
840
- expect(result).toBe('JDS');
841
- });
842
- it('| should handle very long camelCase name', () => {
843
- const result = string_util_1.DyFM_String.anyNameToShortCode('ThisIsAVeryLongCamelCaseName');
844
- expect(result).toBe('TIAVLCCN');
845
- });
846
- it('| should handle name with consecutive uppercase letters', () => {
847
- const result = string_util_1.DyFM_String.anyNameToShortCode('XMLParser');
848
- expect(result).toBe('XP');
849
- });
850
- it('| should handle name with acronym at start', () => {
851
- const result = string_util_1.DyFM_String.anyNameToShortCode('HTMLDocument');
852
- expect(result).toBe('HD');
853
- });
854
- it('| should handle name with acronym in middle', () => {
855
- const result = string_util_1.DyFM_String.anyNameToShortCode('MyHTMLParser');
856
- expect(result).toBe('MHP');
857
- });
858
- });
859
- });
860
- //# sourceMappingURL=string.util.spec.js.map