@kubb/studio 5.12.4 → 5.12.6
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.cjs +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -59,12 +59,23 @@ let node_zlib = require("node:zlib");
|
|
|
59
59
|
*
|
|
60
60
|
* When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
|
|
61
61
|
*/
|
|
62
|
-
function
|
|
62
|
+
function convert(text, pascal) {
|
|
63
63
|
return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
|
|
64
64
|
if (word.length > 1 && word === word.toUpperCase()) return word;
|
|
65
65
|
return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
|
|
66
66
|
}).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
67
67
|
}
|
|
68
|
+
const cache = /* @__PURE__ */ new Map();
|
|
69
|
+
const cacheLimit = 1e4;
|
|
70
|
+
function toCamelOrPascal(text, pascal) {
|
|
71
|
+
const key = `${pascal ? "P" : "c"}${text}`;
|
|
72
|
+
const cached = cache.get(key);
|
|
73
|
+
if (cached !== void 0) return cached;
|
|
74
|
+
const result = convert(text, pascal);
|
|
75
|
+
if (cache.size >= cacheLimit) cache.clear();
|
|
76
|
+
cache.set(key, result);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
68
79
|
/**
|
|
69
80
|
* Converts `text` to camelCase.
|
|
70
81
|
*
|
|
@@ -230,7 +241,7 @@ function getElapsedMs(hrStart) {
|
|
|
230
241
|
}
|
|
231
242
|
//#endregion
|
|
232
243
|
//#region package.json
|
|
233
|
-
var version = "5.12.
|
|
244
|
+
var version = "5.12.6";
|
|
234
245
|
//#endregion
|
|
235
246
|
//#region src/resolveConfig.ts
|
|
236
247
|
/**
|