@ztimson/utils 0.23.14 → 0.23.15
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 +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -1
- package/dist/string.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -539,6 +539,14 @@ const LETTER_LIST = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
|
539
539
|
const NUMBER_LIST = "0123456789";
|
|
540
540
|
const SYMBOL_LIST = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/";
|
|
541
541
|
const CHAR_LIST = LETTER_LIST + LETTER_LIST.toLowerCase() + NUMBER_LIST + SYMBOL_LIST;
|
|
542
|
+
function camelCase(text) {
|
|
543
|
+
if (!text) return "";
|
|
544
|
+
text = text.replaceAll(/^[0-9]+/g, "").replaceAll(/[^a-zA-Z0-9]+(\w?)/g, (...args) => {
|
|
545
|
+
var _a;
|
|
546
|
+
return ((_a = args[1]) == null ? void 0 : _a.toUpperCase()) || "";
|
|
547
|
+
});
|
|
548
|
+
return text[0].toLowerCase() + text.slice(1);
|
|
549
|
+
}
|
|
542
550
|
function formatBytes(bytes, decimals = 2) {
|
|
543
551
|
if (bytes === 0) return "0 Bytes";
|
|
544
552
|
const k = 1024;
|
|
@@ -1698,6 +1706,7 @@ export {
|
|
|
1698
1706
|
adjustedInterval,
|
|
1699
1707
|
arrayDiff,
|
|
1700
1708
|
blackOrWhite,
|
|
1709
|
+
camelCase,
|
|
1701
1710
|
caseInsensitiveSort,
|
|
1702
1711
|
clean,
|
|
1703
1712
|
dec2Frac,
|