@futdevpro/fsm-dynamo 1.14.36 → 1.14.37
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/utils/string-case.util.d.ts +136 -0
- package/build/_collections/utils/string-case.util.d.ts.map +1 -0
- package/build/_collections/utils/string-case.util.js +337 -0
- package/build/_collections/utils/string-case.util.js.map +1 -0
- package/build/_collections/utils/string-case.util.spec.d.ts +2 -0
- package/build/_collections/utils/string-case.util.spec.d.ts.map +1 -0
- package/build/_collections/utils/string-case.util.spec.js +360 -0
- package/build/_collections/utils/string-case.util.spec.js.map +1 -0
- package/build/_collections/utils/string.util.d.ts +2 -22
- package/build/_collections/utils/string.util.d.ts.map +1 -1
- package/build/_collections/utils/string.util.js +2 -111
- package/build/_collections/utils/string.util.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.14.37.tgz +0 -0
- package/package.json +2 -2
- package/src/_collections/utils/string-case.util.spec.ts +441 -0
- package/src/_collections/utils/string-case.util.ts +362 -0
- package/src/_collections/utils/string.util.ts +3 -120
- package/src/index.ts +1 -0
- package/futdevpro-fsm-dynamo-01.14.36.tgz +0 -0
package/build/index.js
CHANGED
|
@@ -18,6 +18,7 @@ tslib_1.__exportStar(require("./_collections/utils/round-list.util"), exports);
|
|
|
18
18
|
tslib_1.__exportStar(require("./_collections/utils/object.util"), exports);
|
|
19
19
|
tslib_1.__exportStar(require("./_collections/utils/stack.util"), exports);
|
|
20
20
|
tslib_1.__exportStar(require("./_collections/utils/string.util"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./_collections/utils/string-case.util"), exports);
|
|
21
22
|
tslib_1.__exportStar(require("./_collections/utils/time.util"), exports);
|
|
22
23
|
tslib_1.__exportStar(require("./_collections/utils/type-cloning-facility.util"), exports);
|
|
23
24
|
tslib_1.__exportStar(require("./_collections/utils/utilities.util"), exports);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,cAAc;AACd,wBAAwB;AACxB,oFAA0D;AAC1D,wFAA8D;AAC9D,yFAA+D;AAC/D,iFAAuD;AACvD,+EAAqD;AAErD,oBAAoB;AACpB,0EAAgD;AAChD,0EAAgD;AAChD,yEAA+C;AAC/C,sFAA4D;AAC5D,wEAA8C;AAC9C,+EAAqD;AACrD,2EAAiD;AACjD,0EAAgD;AAChD,2EAAiD;AACjD,yEAA+C;AAC/C,0FAAgE;AAChE,8EAAoD;AACpD,yEAA+C;AAE/C,yBAAyB;AACzB,oFAA0D;AAC1D,8EAAoD;AACpD,gFAAsD;AACtD,sFAA4D;AAC5D,iFAAuD;AAEvD,2BAA2B;AAC3B,yFAA+D;AAC/D,gFAAsD;AACtD,yFAA+D;AAG/D,QAAQ;AACR,4EAAkD;AAClD,wEAA8C;AAC9C,yEAA+C;AAC/C,oEAA0C;AAC1C,kEAAwC;AACxC,iFAAuD;AAEvD,aAAa;AACb,4EAAkD;AAClD,6EAAmD;AACnD,gFAAsD;AAEtD,aAAa;AACb,yEAA+C;AAC/C,mEAAyC;AACzC,2EAAiD;AAGjD,SAAS;AACT,wBAAwB;AACxB,mGAAyE;AACzE,sGAA4E;AAC5E,uFAA6D;AAC7D,sFAA4D;AAC5D,6FAAmE;AACnE,+FAAqE;AACrE,gHAAsF;AAEtF,6BAA6B;AAC7B,0GAAgF;AAChF,mGAAyE;AACzE,iGAAuE;AAEvE,qBAAqB;AACrB,kFAAwD;AACxD,oFAA0D;AAE1D,oBAAoB;AACpB,oFAA0D;AAC1D,wFAA8D;AAC9D,+EAAqD;AACrD,uFAA6D;AAC7D,wFAA8D;AAC9D,sFAA4D;AAC5D,uFAA6D;AAC7D,iGAAuE;AACvE,iFAAuD;AAEvD,gCAAgC;AAChC,yGAA+E;AAC/E,qGAA2E;AAE3E,eAAe;AACf,yEAA+C;AAC/C,uEAA6C;AAC7C,yEAA+C;AAC/C,uEAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,cAAc;AACd,wBAAwB;AACxB,oFAA0D;AAC1D,wFAA8D;AAC9D,yFAA+D;AAC/D,iFAAuD;AACvD,+EAAqD;AAErD,oBAAoB;AACpB,0EAAgD;AAChD,0EAAgD;AAChD,yEAA+C;AAC/C,sFAA4D;AAC5D,wEAA8C;AAC9C,+EAAqD;AACrD,2EAAiD;AACjD,0EAAgD;AAChD,2EAAiD;AACjD,gFAAsD;AACtD,yEAA+C;AAC/C,0FAAgE;AAChE,8EAAoD;AACpD,yEAA+C;AAE/C,yBAAyB;AACzB,oFAA0D;AAC1D,8EAAoD;AACpD,gFAAsD;AACtD,sFAA4D;AAC5D,iFAAuD;AAEvD,2BAA2B;AAC3B,yFAA+D;AAC/D,gFAAsD;AACtD,yFAA+D;AAG/D,QAAQ;AACR,4EAAkD;AAClD,wEAA8C;AAC9C,yEAA+C;AAC/C,oEAA0C;AAC1C,kEAAwC;AACxC,iFAAuD;AAEvD,aAAa;AACb,4EAAkD;AAClD,6EAAmD;AACnD,gFAAsD;AAEtD,aAAa;AACb,yEAA+C;AAC/C,mEAAyC;AACzC,2EAAiD;AAGjD,SAAS;AACT,wBAAwB;AACxB,mGAAyE;AACzE,sGAA4E;AAC5E,uFAA6D;AAC7D,sFAA4D;AAC5D,6FAAmE;AACnE,+FAAqE;AACrE,gHAAsF;AAEtF,6BAA6B;AAC7B,0GAAgF;AAChF,mGAAyE;AACzE,iGAAuE;AAEvE,qBAAqB;AACrB,kFAAwD;AACxD,oFAA0D;AAE1D,oBAAoB;AACpB,oFAA0D;AAC1D,wFAA8D;AAC9D,+EAAqD;AACrD,uFAA6D;AAC7D,wFAA8D;AAC9D,sFAA4D;AAC5D,uFAA6D;AAC7D,iGAAuE;AACvE,iFAAuD;AAEvD,gCAAgC;AAChC,yGAA+E;AAC/E,qGAA2E;AAE3E,eAAe;AACf,yEAA+C;AAC/C,uEAA6C;AAC7C,yEAA+C;AAC/C,uEAA6C"}
|
|
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.37",
|
|
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",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
"uuid": "11.1.0"
|
|
212
212
|
},
|
|
213
213
|
"devDependencies": {
|
|
214
|
-
"@futdevpro/dynamo-eslint": "1.14.
|
|
214
|
+
"@futdevpro/dynamo-eslint": "1.14.32",
|
|
215
215
|
"@types/jasmine": "~4.3.5",
|
|
216
216
|
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
217
217
|
"@typescript-eslint/parser": "^8.41.0",
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { DyFM_StringCase, DyFM_StringCase_Type } from './string-case.util';
|
|
2
|
+
|
|
3
|
+
describe('DyFM_StringCase', () => {
|
|
4
|
+
describe('| parseWords', () => {
|
|
5
|
+
it('| should parse camelCase to words', () => {
|
|
6
|
+
const result = DyFM_StringCase.parseWords('stockItemId');
|
|
7
|
+
expect(result).toEqual(['stock', 'item', 'id']);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('| should parse PascalCase to words', () => {
|
|
11
|
+
const result = DyFM_StringCase.parseWords('StockItemId');
|
|
12
|
+
expect(result).toEqual(['stock', 'item', 'id']);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('| should parse kebab-case to words', () => {
|
|
16
|
+
const result = DyFM_StringCase.parseWords('stock-item-id');
|
|
17
|
+
expect(result).toEqual(['stock', 'item', 'id']);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('| should parse snake_case to words', () => {
|
|
21
|
+
const result = DyFM_StringCase.parseWords('stock_item_id');
|
|
22
|
+
expect(result).toEqual(['stock', 'item', 'id']);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('| should parse space-separated to words', () => {
|
|
26
|
+
const result = DyFM_StringCase.parseWords('stock item id');
|
|
27
|
+
expect(result).toEqual(['stock', 'item', 'id']);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('| should handle mixed separators', () => {
|
|
31
|
+
const result = DyFM_StringCase.parseWords('stock_item-id itemId');
|
|
32
|
+
expect(result).toEqual(['stock', 'item', 'id', 'item', 'id']);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('| should handle acronyms', () => {
|
|
36
|
+
const result = DyFM_StringCase.parseWords('XMLParser');
|
|
37
|
+
expect(result).toEqual(['xml', 'parser']);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('| should handle empty string', () => {
|
|
41
|
+
const result = DyFM_StringCase.parseWords('');
|
|
42
|
+
expect(result).toEqual([]);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('| toCamelCase', () => {
|
|
47
|
+
it('| should convert kebab-case to camelCase', () => {
|
|
48
|
+
const result = DyFM_StringCase.toCamelCase('stock-item-id');
|
|
49
|
+
expect(result).toBe('stockItemId');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('| should convert snake_case to camelCase', () => {
|
|
53
|
+
const result = DyFM_StringCase.toCamelCase('stock_item_id');
|
|
54
|
+
expect(result).toBe('stockItemId');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('| should convert PascalCase to camelCase', () => {
|
|
58
|
+
const result = DyFM_StringCase.toCamelCase('StockItemId');
|
|
59
|
+
expect(result).toBe('stockItemId');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('| should keep camelCase as camelCase', () => {
|
|
63
|
+
const result = DyFM_StringCase.toCamelCase('stockItemId');
|
|
64
|
+
expect(result).toBe('stockItemId');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('| should convert space-separated to camelCase', () => {
|
|
68
|
+
const result = DyFM_StringCase.toCamelCase('stock item id');
|
|
69
|
+
expect(result).toBe('stockItemId');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('| should handle single word', () => {
|
|
73
|
+
const result = DyFM_StringCase.toCamelCase('stock');
|
|
74
|
+
expect(result).toBe('stock');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('| should handle empty string', () => {
|
|
78
|
+
const result = DyFM_StringCase.toCamelCase('');
|
|
79
|
+
expect(result).toBe('');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('| toPascalCase', () => {
|
|
84
|
+
it('| should convert kebab-case to PascalCase', () => {
|
|
85
|
+
const result = DyFM_StringCase.toPascalCase('stock-item-id');
|
|
86
|
+
expect(result).toBe('StockItemId');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('| should convert snake_case to PascalCase', () => {
|
|
90
|
+
const result = DyFM_StringCase.toPascalCase('stock_item_id');
|
|
91
|
+
expect(result).toBe('StockItemId');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('| should convert camelCase to PascalCase', () => {
|
|
95
|
+
const result = DyFM_StringCase.toPascalCase('stockItemId');
|
|
96
|
+
expect(result).toBe('StockItemId');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('| should keep PascalCase as PascalCase', () => {
|
|
100
|
+
const result = DyFM_StringCase.toPascalCase('StockItemId');
|
|
101
|
+
expect(result).toBe('StockItemId');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('| should convert space-separated to PascalCase', () => {
|
|
105
|
+
const result = DyFM_StringCase.toPascalCase('stock item id');
|
|
106
|
+
expect(result).toBe('StockItemId');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('| should handle single word', () => {
|
|
110
|
+
const result = DyFM_StringCase.toPascalCase('stock');
|
|
111
|
+
expect(result).toBe('Stock');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('| should handle empty string', () => {
|
|
115
|
+
const result = DyFM_StringCase.toPascalCase('');
|
|
116
|
+
expect(result).toBe('');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('| toKebabCase', () => {
|
|
121
|
+
it('| should convert camelCase to kebab-case', () => {
|
|
122
|
+
const result = DyFM_StringCase.toKebabCase('stockItemId');
|
|
123
|
+
expect(result).toBe('stock-item-id');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('| should convert PascalCase to kebab-case', () => {
|
|
127
|
+
const result = DyFM_StringCase.toKebabCase('StockItemId');
|
|
128
|
+
expect(result).toBe('stock-item-id');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('| should convert snake_case to kebab-case', () => {
|
|
132
|
+
const result = DyFM_StringCase.toKebabCase('stock_item_id');
|
|
133
|
+
expect(result).toBe('stock-item-id');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('| should keep kebab-case as kebab-case', () => {
|
|
137
|
+
const result = DyFM_StringCase.toKebabCase('stock-item-id');
|
|
138
|
+
expect(result).toBe('stock-item-id');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('| should convert space-separated to kebab-case', () => {
|
|
142
|
+
const result = DyFM_StringCase.toKebabCase('stock item id');
|
|
143
|
+
expect(result).toBe('stock-item-id');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('| should handle single word', () => {
|
|
147
|
+
const result = DyFM_StringCase.toKebabCase('stock');
|
|
148
|
+
expect(result).toBe('stock');
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('| should handle empty string', () => {
|
|
152
|
+
const result = DyFM_StringCase.toKebabCase('');
|
|
153
|
+
expect(result).toBe('');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('| toSnakeCase', () => {
|
|
158
|
+
it('| should convert camelCase to snake_case', () => {
|
|
159
|
+
const result = DyFM_StringCase.toSnakeCase('stockItemId');
|
|
160
|
+
expect(result).toBe('stock_item_id');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('| should convert PascalCase to snake_case', () => {
|
|
164
|
+
const result = DyFM_StringCase.toSnakeCase('StockItemId');
|
|
165
|
+
expect(result).toBe('stock_item_id');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('| should convert kebab-case to snake_case', () => {
|
|
169
|
+
const result = DyFM_StringCase.toSnakeCase('stock-item-id');
|
|
170
|
+
expect(result).toBe('stock_item_id');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('| should keep snake_case as snake_case', () => {
|
|
174
|
+
const result = DyFM_StringCase.toSnakeCase('stock_item_id');
|
|
175
|
+
expect(result).toBe('stock_item_id');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('| should convert space-separated to snake_case', () => {
|
|
179
|
+
const result = DyFM_StringCase.toSnakeCase('stock item id');
|
|
180
|
+
expect(result).toBe('stock_item_id');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('| should handle single word', () => {
|
|
184
|
+
const result = DyFM_StringCase.toSnakeCase('stock');
|
|
185
|
+
expect(result).toBe('stock');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('| should handle empty string', () => {
|
|
189
|
+
const result = DyFM_StringCase.toSnakeCase('');
|
|
190
|
+
expect(result).toBe('');
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe('| convertTo', () => {
|
|
195
|
+
it('| should convert to camelCase using enum', () => {
|
|
196
|
+
const result = DyFM_StringCase.convertTo('stock-item-id', DyFM_StringCase_Type.camelCase);
|
|
197
|
+
expect(result).toBe('stockItemId');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('| should convert to PascalCase using enum', () => {
|
|
201
|
+
const result = DyFM_StringCase.convertTo('stock-item-id', DyFM_StringCase_Type.PascalCase);
|
|
202
|
+
expect(result).toBe('StockItemId');
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('| should convert to kebab-case using enum', () => {
|
|
206
|
+
const result = DyFM_StringCase.convertTo('stockItemId', DyFM_StringCase_Type.kebabCase);
|
|
207
|
+
expect(result).toBe('stock-item-id');
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('| should convert to snake_case using enum', () => {
|
|
211
|
+
const result = DyFM_StringCase.convertTo('stockItemId', DyFM_StringCase_Type.snake_case);
|
|
212
|
+
expect(result).toBe('stock_item_id');
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('| convertToAny', () => {
|
|
217
|
+
it('| should convert to camelCase using string', () => {
|
|
218
|
+
const result = DyFM_StringCase.convertToAny('stock-item-id', 'camelCase');
|
|
219
|
+
expect(result).toBe('stockItemId');
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('| should convert to PascalCase using string', () => {
|
|
223
|
+
const result = DyFM_StringCase.convertToAny('stock-item-id', 'PascalCase');
|
|
224
|
+
expect(result).toBe('StockItemId');
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('| should convert to kebab-case using string', () => {
|
|
228
|
+
const result = DyFM_StringCase.convertToAny('stockItemId', 'kebab-case');
|
|
229
|
+
expect(result).toBe('stock-item-id');
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('| should convert to snake_case using string', () => {
|
|
233
|
+
const result = DyFM_StringCase.convertToAny('stockItemId', 'snake_case');
|
|
234
|
+
expect(result).toBe('stock_item_id');
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('| should handle case-insensitive string input', () => {
|
|
238
|
+
const result = DyFM_StringCase.convertToAny('stockItemId', 'KEBAB-CASE');
|
|
239
|
+
expect(result).toBe('stock-item-id');
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('| should return original string for unknown case type', () => {
|
|
243
|
+
const result = DyFM_StringCase.convertToAny('stockItemId', 'unknown');
|
|
244
|
+
expect(result).toBe('stockItemId');
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
describe('| includesIgnoreCase', () => {
|
|
249
|
+
it('| should find camelCase in path with kebab-case', () => {
|
|
250
|
+
const result = DyFM_StringCase.includesIgnoreCase('/:userId/item/delete/:itemId', 'stockItemId');
|
|
251
|
+
expect(result).toBe(true);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('| should find kebab-case in path with camelCase', () => {
|
|
255
|
+
const result = DyFM_StringCase.includesIgnoreCase('/:userId/item/delete/:itemId', 'stock-item-id');
|
|
256
|
+
expect(result).toBe(true);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('| should find snake_case in path', () => {
|
|
260
|
+
const result = DyFM_StringCase.includesIgnoreCase('/:userId/item/delete/:itemId', 'stock_item_id');
|
|
261
|
+
expect(result).toBe(true);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it('| should find exact match', () => {
|
|
265
|
+
const result = DyFM_StringCase.includesIgnoreCase('/:userId/item/delete/:itemId', 'itemId');
|
|
266
|
+
expect(result).toBe(true);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('| should not find non-existent string', () => {
|
|
270
|
+
const result = DyFM_StringCase.includesIgnoreCase('/:userId/item/delete/:itemId', 'nonExistent');
|
|
271
|
+
expect(result).toBe(false);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('| should handle empty strings', () => {
|
|
275
|
+
const result = DyFM_StringCase.includesIgnoreCase('', 'itemId');
|
|
276
|
+
expect(result).toBe(false);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
describe('| anyNameToShortCode', () => {
|
|
281
|
+
it('| should convert space-separated name to short code', () => {
|
|
282
|
+
const result = DyFM_StringCase.anyNameToShortCode('John Doe');
|
|
283
|
+
expect(result).toBe('JD');
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it('| should convert camelCase name to short code', () => {
|
|
287
|
+
const result = DyFM_StringCase.anyNameToShortCode('JohnDoe');
|
|
288
|
+
expect(result).toBe('JD');
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('| should convert underscore-separated name to short code', () => {
|
|
292
|
+
const result = DyFM_StringCase.anyNameToShortCode('John_Doe');
|
|
293
|
+
expect(result).toBe('JD');
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it('| should convert camelCase starting with lowercase to short code', () => {
|
|
297
|
+
const result = DyFM_StringCase.anyNameToShortCode('johnDoe');
|
|
298
|
+
expect(result).toBe('JD');
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('| should convert lowercase underscore-separated name to short code', () => {
|
|
302
|
+
const result = DyFM_StringCase.anyNameToShortCode('john_doe');
|
|
303
|
+
expect(result).toBe('JD');
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('| should convert hyphen-separated name to short code', () => {
|
|
307
|
+
const result = DyFM_StringCase.anyNameToShortCode('john-doe');
|
|
308
|
+
expect(result).toBe('JD');
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it('| should handle single word name', () => {
|
|
312
|
+
const result = DyFM_StringCase.anyNameToShortCode('John');
|
|
313
|
+
expect(result).toBe('J');
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it('| should handle single lowercase word', () => {
|
|
317
|
+
const result = DyFM_StringCase.anyNameToShortCode('john');
|
|
318
|
+
expect(result).toBe('J');
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it('| should handle three words', () => {
|
|
322
|
+
const result = DyFM_StringCase.anyNameToShortCode('John Michael Doe');
|
|
323
|
+
expect(result).toBe('JMD');
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('| should handle mixed separators', () => {
|
|
327
|
+
const result = DyFM_StringCase.anyNameToShortCode('John_Michael-Doe');
|
|
328
|
+
expect(result).toBe('JMD');
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('| should handle camelCase with multiple words', () => {
|
|
332
|
+
const result = DyFM_StringCase.anyNameToShortCode('JohnMichaelDoe');
|
|
333
|
+
expect(result).toBe('JMD');
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it('| should handle mixed camelCase and separators', () => {
|
|
337
|
+
const result = DyFM_StringCase.anyNameToShortCode('JohnMichael_Doe');
|
|
338
|
+
expect(result).toBe('JMD');
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('| should handle name with multiple spaces', () => {
|
|
342
|
+
const result = DyFM_StringCase.anyNameToShortCode('John Doe');
|
|
343
|
+
expect(result).toBe('JD');
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it('| should handle name with multiple underscores', () => {
|
|
347
|
+
const result = DyFM_StringCase.anyNameToShortCode('John___Doe');
|
|
348
|
+
expect(result).toBe('JD');
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
it('| should handle name with multiple hyphens', () => {
|
|
352
|
+
const result = DyFM_StringCase.anyNameToShortCode('John---Doe');
|
|
353
|
+
expect(result).toBe('JD');
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
it('| should handle name with mixed separators and spaces', () => {
|
|
357
|
+
const result = DyFM_StringCase.anyNameToShortCode('John _- Doe');
|
|
358
|
+
expect(result).toBe('JD');
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('| should handle empty string', () => {
|
|
362
|
+
const result = DyFM_StringCase.anyNameToShortCode('');
|
|
363
|
+
expect(result).toBe('');
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('| should handle string with only spaces', () => {
|
|
367
|
+
const result = DyFM_StringCase.anyNameToShortCode(' ');
|
|
368
|
+
expect(result).toBe('');
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('| should handle string with only separators', () => {
|
|
372
|
+
const result = DyFM_StringCase.anyNameToShortCode('___---');
|
|
373
|
+
expect(result).toBe('');
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it('| should handle name with leading and trailing spaces', () => {
|
|
377
|
+
const result = DyFM_StringCase.anyNameToShortCode(' John Doe ');
|
|
378
|
+
expect(result).toBe('JD');
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('| should handle name with leading and trailing separators', () => {
|
|
382
|
+
const result = DyFM_StringCase.anyNameToShortCode('_John_Doe_');
|
|
383
|
+
expect(result).toBe('JD');
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('| should handle all uppercase name', () => {
|
|
387
|
+
const result = DyFM_StringCase.anyNameToShortCode('JOHN DOE');
|
|
388
|
+
expect(result).toBe('JD');
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('| should handle all uppercase camelCase', () => {
|
|
392
|
+
const result = DyFM_StringCase.anyNameToShortCode('JOHNDOE');
|
|
393
|
+
expect(result).toBe('J');
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it('| should handle name with numbers', () => {
|
|
397
|
+
const result = DyFM_StringCase.anyNameToShortCode('John2 Doe3');
|
|
398
|
+
expect(result).toBe('JD');
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it('| should handle name starting with number', () => {
|
|
402
|
+
const result = DyFM_StringCase.anyNameToShortCode('2John Doe');
|
|
403
|
+
expect(result).toBe('JD');
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it('| should handle complex camelCase with numbers', () => {
|
|
407
|
+
const result = DyFM_StringCase.anyNameToShortCode('john2Doe3Smith');
|
|
408
|
+
expect(result).toBe('JDS');
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('| should handle single character', () => {
|
|
412
|
+
const result = DyFM_StringCase.anyNameToShortCode('J');
|
|
413
|
+
expect(result).toBe('J');
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('| should handle name with special characters', () => {
|
|
417
|
+
const result = DyFM_StringCase.anyNameToShortCode('John@Doe#Smith');
|
|
418
|
+
expect(result).toBe('JDS');
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('| should handle very long camelCase name', () => {
|
|
422
|
+
const result = DyFM_StringCase.anyNameToShortCode('ThisIsAVeryLongCamelCaseName');
|
|
423
|
+
expect(result).toBe('TIAVLCCN');
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it('| should handle name with consecutive uppercase letters', () => {
|
|
427
|
+
const result = DyFM_StringCase.anyNameToShortCode('XMLParser');
|
|
428
|
+
expect(result).toBe('XP');
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
it('| should handle name with acronym at start', () => {
|
|
432
|
+
const result = DyFM_StringCase.anyNameToShortCode('HTMLDocument');
|
|
433
|
+
expect(result).toBe('HD');
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
it('| should handle name with acronym in middle', () => {
|
|
437
|
+
const result = DyFM_StringCase.anyNameToShortCode('MyHTMLParser');
|
|
438
|
+
expect(result).toBe('MHP');
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
});
|