@xeno-js/cli 0.1.0 → 0.1.1
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/dist/index.js +3675 -18
- package/dist/index.js.map +1 -0
- package/eslint.config.mjs +1 -0
- package/package.json +4 -3
- package/tsup.config.ts +13 -0
- package/dist/domain/contracts/icommand-cli.contracts.js +0 -2
- package/dist/domain/contracts/icommand-runner.contracts.js +0 -2
- package/dist/domain/contracts/idispatch.contracts.js +0 -2
- package/dist/domain/contracts/ifile-service.contracts.js +0 -2
- package/dist/domain/contracts/igenerator.contracts.js +0 -2
- package/dist/domain/contracts/index.js +0 -2
- package/dist/domain/contracts/iscaffold-strategy.contracts.js +0 -2
- package/dist/domain/index.js +0 -2
- package/dist/generator.contracts.js +0 -13
- package/dist/infrastructure/bootstrap/bootstrapper.js +0 -32
- package/dist/infrastructure/bootstrap/index.js +0 -17
- package/dist/infrastructure/builder/builder.js +0 -16
- package/dist/infrastructure/builder/builder.test.js +0 -30
- package/dist/infrastructure/builder/index.js +0 -17
- package/dist/infrastructure/command_launcher/command.utils.js +0 -30
- package/dist/infrastructure/command_launcher/index.js +0 -2
- package/dist/infrastructure/commands/command-runner.service.js +0 -36
- package/dist/infrastructure/commands/generate.command.js +0 -48
- package/dist/infrastructure/commands/help.command.js +0 -44
- package/dist/infrastructure/commands/index.js +0 -20
- package/dist/infrastructure/commands/new-project.command.js +0 -43
- package/dist/infrastructure/dispatcher/dispatcher.js +0 -39
- package/dist/infrastructure/dispatcher/index.js +0 -17
- package/dist/infrastructure/file/file.service.js +0 -13
- package/dist/infrastructure/file/index.js +0 -17
- package/dist/infrastructure/generators/bootstrap.generator.js +0 -118
- package/dist/infrastructure/generators/core/bootstrap.generator.js +0 -118
- package/dist/infrastructure/generators/core/command/cqrs.generator.js +0 -49
- package/dist/infrastructure/generators/core/command/generate-command.generator.js +0 -163
- package/dist/infrastructure/generators/core/command/generate-query.generator.js +0 -131
- package/dist/infrastructure/generators/core/drizzle-sql-lite.generator.js +0 -78
- package/dist/infrastructure/generators/core/drizzle.generator.js +0 -85
- package/dist/infrastructure/generators/core/env.generator.js +0 -69
- package/dist/infrastructure/generators/core/index.js +0 -25
- package/dist/infrastructure/generators/core/main.generator.js +0 -45
- package/dist/infrastructure/generators/core/packagejson.generator.js +0 -78
- package/dist/infrastructure/generators/core/readme.generator.js +0 -431
- package/dist/infrastructure/generators/core/registry.generator.js +0 -46
- package/dist/infrastructure/generators/core/tsconfig.generator.js +0 -41
- package/dist/infrastructure/generators/core-packagejson.generator.js +0 -78
- package/dist/infrastructure/generators/drizzle-sql-lite.generator.js +0 -78
- package/dist/infrastructure/generators/drizzle.generator.js +0 -85
- package/dist/infrastructure/generators/env-vue.generator.js +0 -40
- package/dist/infrastructure/generators/env.generator.js +0 -71
- package/dist/infrastructure/generators/gitignore.generator.js +0 -62
- package/dist/infrastructure/generators/index.js +0 -26
- package/dist/infrastructure/generators/main.generator.js +0 -45
- package/dist/infrastructure/generators/readme.generator.js +0 -431
- package/dist/infrastructure/generators/registry.generator.js +0 -46
- package/dist/infrastructure/generators/tsconfig-vue.generator.js +0 -39
- package/dist/infrastructure/generators/tsconfig.generator.js +0 -41
- package/dist/infrastructure/generators/vite-config.generator.js +0 -39
- package/dist/infrastructure/generators/vue/app-vue.generator.js +0 -26
- package/dist/infrastructure/generators/vue/bootstrap-ts.generator.js +0 -59
- package/dist/infrastructure/generators/vue/command_query/cqrs.generator.js +0 -36
- package/dist/infrastructure/generators/vue/command_query/generate-command-vue.generator.js +0 -139
- package/dist/infrastructure/generators/vue/command_query/generate-query-vue.generator.js +0 -147
- package/dist/infrastructure/generators/vue/env.generator.js +0 -40
- package/dist/infrastructure/generators/vue/index-html.generator.js +0 -29
- package/dist/infrastructure/generators/vue/index.js +0 -28
- package/dist/infrastructure/generators/vue/main.generator.js +0 -45
- package/dist/infrastructure/generators/vue/packagejson.generator.js +0 -59
- package/dist/infrastructure/generators/vue/readme.generator.js +0 -394
- package/dist/infrastructure/generators/vue/registry-ts.generator.js +0 -28
- package/dist/infrastructure/generators/vue/router.generator.js +0 -33
- package/dist/infrastructure/generators/vue/tailwind.generator.js +0 -19
- package/dist/infrastructure/generators/vue/tsconfig.generator.js +0 -39
- package/dist/infrastructure/generators/vue/use-app.generator.js +0 -43
- package/dist/infrastructure/generators/vue/vite-config.generator.js +0 -39
- package/dist/infrastructure/generators/vue-packagejson.generator.js +0 -59
- package/dist/infrastructure/generators/vue-readme.generator.js +0 -53
- package/dist/infrastructure/generators/vue-source-files.generator.js +0 -136
- package/dist/infrastructure/index.js +0 -21
- package/dist/infrastructure/strategies/core-scaffold.strategy.js +0 -99
- package/dist/infrastructure/strategies/index.js +0 -18
- package/dist/infrastructure/strategies/vue-scaffold.strategy.js +0 -79
- package/dist/scaffolding.engine.js +0 -60
- package/dist/shared/constants/command.constants.js +0 -19
- package/dist/shared/constants/core.constants.js +0 -10
- package/dist/shared/constants/index.js +0 -18
- package/dist/shared/index.js +0 -18
- package/dist/shared/types/common.types.js +0 -2
- package/dist/shared/types/index.js +0 -2
- package/dist/shared/utils/guards.utils.js +0 -310
- package/dist/shared/utils/index.js +0 -18
- package/dist/shared/utils/string.utils.js +0 -62
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Guards = void 0;
|
|
4
|
-
const OBJECT_TAG = '[object Object]';
|
|
5
|
-
const DATE_TAG = '[object Date]';
|
|
6
|
-
/**
|
|
7
|
-
* @description Centralized type guards and runtime predicates.
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @author Xeno
|
|
11
|
-
* @version 1.0.0
|
|
12
|
-
* @since 2025-09-30
|
|
13
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
14
|
-
*/
|
|
15
|
-
exports.Guards = Object.freeze({
|
|
16
|
-
/**
|
|
17
|
-
* @description Checks value is neither null nor undefined.
|
|
18
|
-
* @param value Candidate value.
|
|
19
|
-
* @returns True when value is defined.
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @author Xeno
|
|
23
|
-
* @version 1.0.0
|
|
24
|
-
* @since 2025-09-30
|
|
25
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
26
|
-
*/
|
|
27
|
-
isDefined(value) {
|
|
28
|
-
return value !== null && value !== undefined && value !== '' && !Number.isNaN(value);
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* @description Checks value is null, undefined, empty string, or false.
|
|
32
|
-
* @param value Candidate value.
|
|
33
|
-
* @returns True when value is null, undefined, empty string, or false.
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
* @author Xeno
|
|
37
|
-
* @version 1.0.0
|
|
38
|
-
* @since 2025-09-30
|
|
39
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
40
|
-
*/
|
|
41
|
-
isNullOrEmpty(value) {
|
|
42
|
-
return (!exports.Guards.isDefined(value) ||
|
|
43
|
-
(exports.Guards.isString(value) && value.trim() === '') ||
|
|
44
|
-
(exports.Guards.isArray(value) && value.length === 0));
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* @description Throws an error if the value is null, undefined, empty string, or false.
|
|
48
|
-
* @param value Candidate value.
|
|
49
|
-
* @param errorMessage Error message to throw if the check fails.
|
|
50
|
-
* @throws Error with the provided message if the value is null, undefined, empty string, or false.
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
* @author Xeno
|
|
54
|
-
* @version 1.0.0
|
|
55
|
-
* @since 2025-09-30
|
|
56
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
57
|
-
*/
|
|
58
|
-
throwIfNullOrEmpty(value, errorMessage) {
|
|
59
|
-
if (exports.Guards.isNullOrEmpty(value)) {
|
|
60
|
-
throw new Error(errorMessage);
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* @description Throws an error if the value is not a positive integer.
|
|
65
|
-
* @param value Candidate value.
|
|
66
|
-
* @param errorMessage Error message to throw if the check fails.
|
|
67
|
-
* @throws Error with the provided message if the value is not a positive integer.
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
* @author Xeno
|
|
71
|
-
* @version 1.0.0
|
|
72
|
-
* @since 2025-09-30
|
|
73
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
74
|
-
*/
|
|
75
|
-
throwIfNegative(value, errorMessage) {
|
|
76
|
-
if (exports.Guards.isInteger(value) && value < 0) {
|
|
77
|
-
throw new Error(errorMessage);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* @description Throws an error if the value is not an integer.
|
|
82
|
-
* @param value Candidate value.
|
|
83
|
-
* @param errorMessage Error message to throw if the check fails.
|
|
84
|
-
* @throws Error with the provided message if the value is not an integer.
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
* @author Xeno
|
|
88
|
-
* @version 1.0.0
|
|
89
|
-
* @since 2025-09-30
|
|
90
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
91
|
-
*/
|
|
92
|
-
throwIfNotInteger(value, errorMessage) {
|
|
93
|
-
if (!exports.Guards.isInteger(value)) {
|
|
94
|
-
throw new Error(errorMessage);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
/**
|
|
98
|
-
* @description Checks if an object has a method with the given name.
|
|
99
|
-
* @param obj Object to check.
|
|
100
|
-
* @param methodName Name of the method to look for.
|
|
101
|
-
* @returns True when obj has a function property named methodName.
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
* @author Xeno
|
|
105
|
-
* @version 1.0.0
|
|
106
|
-
* @since 2025-09-30
|
|
107
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
108
|
-
*/
|
|
109
|
-
hasMethod(obj, methodName) {
|
|
110
|
-
if (!this.isDefined(obj))
|
|
111
|
-
return false;
|
|
112
|
-
// Essendo all'interno del namespace di utilità, l'uso di typeof qui è consentito
|
|
113
|
-
return exports.Guards.isFunction(obj[methodName]);
|
|
114
|
-
},
|
|
115
|
-
/**
|
|
116
|
-
* @description Checks value is a string.
|
|
117
|
-
* @param value Candidate value.
|
|
118
|
-
* @returns True when value is string.
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
* @author Xeno
|
|
122
|
-
* @version 1.0.0
|
|
123
|
-
* @since 2025-09-30
|
|
124
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
125
|
-
*/
|
|
126
|
-
isString(value) {
|
|
127
|
-
return typeof value === 'string';
|
|
128
|
-
},
|
|
129
|
-
/**
|
|
130
|
-
* @description Checks value is a finite number.
|
|
131
|
-
* @param value Candidate value.
|
|
132
|
-
* @returns True when value is finite number.
|
|
133
|
-
|
|
134
|
-
*
|
|
135
|
-
* @author Xeno
|
|
136
|
-
* @version 1.0.0
|
|
137
|
-
* @since 2025-09-30
|
|
138
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
139
|
-
*/
|
|
140
|
-
isNumber(value) {
|
|
141
|
-
return typeof value === 'number' && Number.isFinite(value);
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* @description Checks value is an integer number.
|
|
145
|
-
* @param value Candidate value.
|
|
146
|
-
* @returns True when value is integer number.
|
|
147
|
-
|
|
148
|
-
*
|
|
149
|
-
* @author Xeno
|
|
150
|
-
* @version 1.0.0
|
|
151
|
-
* @since 2025-09-30
|
|
152
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
153
|
-
*/
|
|
154
|
-
isInteger(value) {
|
|
155
|
-
return exports.Guards.isNumber(value) && Number.isInteger(value);
|
|
156
|
-
},
|
|
157
|
-
/**
|
|
158
|
-
* @description Checks value is boolean.
|
|
159
|
-
* @param value Candidate value.
|
|
160
|
-
* @returns True when value is boolean.
|
|
161
|
-
|
|
162
|
-
*
|
|
163
|
-
* @author Xeno
|
|
164
|
-
* @version 1.0.0
|
|
165
|
-
* @since 2025-09-30
|
|
166
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
167
|
-
*/
|
|
168
|
-
isBoolean(value) {
|
|
169
|
-
return typeof value === 'boolean';
|
|
170
|
-
},
|
|
171
|
-
/**
|
|
172
|
-
* @description Checks value is bigint.
|
|
173
|
-
* @param value Candidate value.
|
|
174
|
-
* @returns True when value is bigint.
|
|
175
|
-
|
|
176
|
-
*
|
|
177
|
-
* @author Xeno
|
|
178
|
-
* @version 1.0.0
|
|
179
|
-
* @since 2025-09-30
|
|
180
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
181
|
-
*/
|
|
182
|
-
isBigInt(value) {
|
|
183
|
-
return typeof value === 'bigint';
|
|
184
|
-
},
|
|
185
|
-
/**
|
|
186
|
-
* @description Checks value is symbol.
|
|
187
|
-
* @param value Candidate value.
|
|
188
|
-
* @returns True when value is symbol.
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
* @author Xeno
|
|
192
|
-
* @version 1.0.0
|
|
193
|
-
* @since 2025-09-30
|
|
194
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
195
|
-
*/
|
|
196
|
-
isSymbol(value) {
|
|
197
|
-
return typeof value === 'symbol';
|
|
198
|
-
},
|
|
199
|
-
/**
|
|
200
|
-
* @description Checks value is a function.
|
|
201
|
-
* @param value Candidate value.
|
|
202
|
-
* @returns True when value is function.
|
|
203
|
-
|
|
204
|
-
*
|
|
205
|
-
* @author Xeno
|
|
206
|
-
* @version 1.0.0
|
|
207
|
-
* @since 2025-09-30
|
|
208
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
209
|
-
*/
|
|
210
|
-
isFunction(value) {
|
|
211
|
-
return typeof value === 'function';
|
|
212
|
-
},
|
|
213
|
-
/**
|
|
214
|
-
* @description Checks value is an array.
|
|
215
|
-
* @param value Candidate value.
|
|
216
|
-
* @returns True when value is array.
|
|
217
|
-
|
|
218
|
-
*
|
|
219
|
-
* @author Xeno
|
|
220
|
-
* @version 1.0.0
|
|
221
|
-
* @since 2025-09-30
|
|
222
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
223
|
-
*/
|
|
224
|
-
isArray(value) {
|
|
225
|
-
return Array.isArray(value);
|
|
226
|
-
},
|
|
227
|
-
/**
|
|
228
|
-
* @description Checks value is a Date instance with valid timestamp.
|
|
229
|
-
* @param value Candidate value.
|
|
230
|
-
* @returns True when value is valid Date.
|
|
231
|
-
|
|
232
|
-
*
|
|
233
|
-
* @author Xeno
|
|
234
|
-
* @version 1.0.0
|
|
235
|
-
* @since 2025-09-30
|
|
236
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
237
|
-
*/
|
|
238
|
-
isDate(value) {
|
|
239
|
-
if (Object.prototype.toString.call(value) !== DATE_TAG) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
return Number.isFinite(value.getTime());
|
|
243
|
-
},
|
|
244
|
-
/**
|
|
245
|
-
* @description Checks value is an Error instance.
|
|
246
|
-
* @param value Candidate value.
|
|
247
|
-
* @returns True when value is Error.
|
|
248
|
-
|
|
249
|
-
*
|
|
250
|
-
* @author Xeno
|
|
251
|
-
* @version 1.0.0
|
|
252
|
-
* @since 2025-09-30
|
|
253
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
254
|
-
*/
|
|
255
|
-
isError(value) {
|
|
256
|
-
return value instanceof Error;
|
|
257
|
-
},
|
|
258
|
-
/**
|
|
259
|
-
* @description Checks value is a plain object record.
|
|
260
|
-
* @param value Candidate value.
|
|
261
|
-
* @returns True when value is object record.
|
|
262
|
-
|
|
263
|
-
*
|
|
264
|
-
* @author Xeno
|
|
265
|
-
* @version 1.0.0
|
|
266
|
-
* @since 2025-09-30
|
|
267
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
268
|
-
*/
|
|
269
|
-
isObjectRecord(value) {
|
|
270
|
-
if (!exports.Guards.isDefined(value)) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
return Object.prototype.toString.call(value) === OBJECT_TAG;
|
|
274
|
-
},
|
|
275
|
-
/**
|
|
276
|
-
* @description Checks value is an object (not null).
|
|
277
|
-
* @param value Candidate value.
|
|
278
|
-
* @returns True when value is object.
|
|
279
|
-
|
|
280
|
-
*
|
|
281
|
-
* @author Xeno
|
|
282
|
-
* @version 1.0.0
|
|
283
|
-
* @since 2025-09-30
|
|
284
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
285
|
-
*/
|
|
286
|
-
isObject(value) {
|
|
287
|
-
return typeof value === 'object' && exports.Guards.isDefined(value);
|
|
288
|
-
},
|
|
289
|
-
/**
|
|
290
|
-
* @description Checks value is PromiseLike.
|
|
291
|
-
* @param value Candidate value.
|
|
292
|
-
* @returns True when value has then function.
|
|
293
|
-
|
|
294
|
-
*
|
|
295
|
-
* @author Xeno
|
|
296
|
-
* @version 1.0.0
|
|
297
|
-
* @since 2025-09-30
|
|
298
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
299
|
-
*/
|
|
300
|
-
isPromiseLike(value) {
|
|
301
|
-
if (!exports.Guards.isDefined(value)) {
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
if (!exports.Guards.isObject(value) && !exports.Guards.isFunction(value)) {
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
const thenMember = value['then'];
|
|
308
|
-
return exports.Guards.isFunction(thenMember);
|
|
309
|
-
},
|
|
310
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./guards.utils"), exports);
|
|
18
|
-
__exportStar(require("./string.utils"), exports);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StringUtils = void 0;
|
|
4
|
-
const guards_utils_1 = require("./guards.utils");
|
|
5
|
-
exports.StringUtils = Object.freeze({
|
|
6
|
-
/**
|
|
7
|
-
* @description Inserisce un underscore (_) tra la fine di una parola e l'inizio della successiva in formato camelCase o PascalCase.
|
|
8
|
-
* @param input Stringa in input (es. "CreateUser").
|
|
9
|
-
* @returns Stringa separata da underscore (es. "Create_User").
|
|
10
|
-
*
|
|
11
|
-
* @author Xeno
|
|
12
|
-
* @version 1.0.0
|
|
13
|
-
* @since 2026-09-18
|
|
14
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
15
|
-
*/
|
|
16
|
-
splitCamelCaseWithUnderscore(input) {
|
|
17
|
-
if (!guards_utils_1.Guards.isString(input) || guards_utils_1.Guards.isNullOrEmpty(input))
|
|
18
|
-
return input;
|
|
19
|
-
return input.replace(/([a-z])([A-Z])/g, '$1_$2');
|
|
20
|
-
},
|
|
21
|
-
/**
|
|
22
|
-
* @description Converts a string to camelCase.
|
|
23
|
-
* @param input Input string (supports snake_case, kebab-case, or space-separated).
|
|
24
|
-
* @returns camelCase string.
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* @author Xeno
|
|
28
|
-
* @version 1.0.0
|
|
29
|
-
* @since 2025-09-30
|
|
30
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
31
|
-
*/
|
|
32
|
-
camelCase(input) {
|
|
33
|
-
const segments = input.split(/[-_\s]+/);
|
|
34
|
-
const [first, ...rest] = segments;
|
|
35
|
-
const head = guards_utils_1.Guards.isDefined(first) ? first.toLowerCase() : '';
|
|
36
|
-
return head + rest.map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join('');
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* @description Converts a string to PascalCase.
|
|
40
|
-
* @param input Input string (supports snake_case, kebab-case, space-separated, or camelCase).
|
|
41
|
-
* @returns PascalCase string.
|
|
42
|
-
*
|
|
43
|
-
* @author Xeno
|
|
44
|
-
* @version 1.0.0
|
|
45
|
-
* @since 2026-09-18
|
|
46
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
47
|
-
*/
|
|
48
|
-
pascalCase(input) {
|
|
49
|
-
if (!guards_utils_1.Guards.isString(input) || guards_utils_1.Guards.isNullOrEmpty(input))
|
|
50
|
-
return '';
|
|
51
|
-
const segments = input.split(/[-_\s]+/);
|
|
52
|
-
return segments
|
|
53
|
-
.filter((seg) => seg.length > 0)
|
|
54
|
-
.map((seg) => {
|
|
55
|
-
// Se il segmento è tutto maiuscolo (es. CREATE), lo normalizziamo in minuscolo per evitare cREATE.
|
|
56
|
-
// Altrimenti, preserviamo il casing interno originale (es. UserService resta UserService).
|
|
57
|
-
const normalized = seg === seg.toUpperCase() ? seg.toLowerCase() : seg;
|
|
58
|
-
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
59
|
-
})
|
|
60
|
-
.join('');
|
|
61
|
-
},
|
|
62
|
-
});
|