@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.cjs
CHANGED
|
@@ -543,6 +543,14 @@ ${opts.message || this.desc}`;
|
|
|
543
543
|
const NUMBER_LIST = "0123456789";
|
|
544
544
|
const SYMBOL_LIST = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/";
|
|
545
545
|
const CHAR_LIST = LETTER_LIST + LETTER_LIST.toLowerCase() + NUMBER_LIST + SYMBOL_LIST;
|
|
546
|
+
function camelCase(text) {
|
|
547
|
+
if (!text) return "";
|
|
548
|
+
text = text.replaceAll(/^[0-9]+/g, "").replaceAll(/[^a-zA-Z0-9]+(\w?)/g, (...args) => {
|
|
549
|
+
var _a;
|
|
550
|
+
return ((_a = args[1]) == null ? void 0 : _a.toUpperCase()) || "";
|
|
551
|
+
});
|
|
552
|
+
return text[0].toLowerCase() + text.slice(1);
|
|
553
|
+
}
|
|
546
554
|
function formatBytes(bytes, decimals = 2) {
|
|
547
555
|
if (bytes === 0) return "0 Bytes";
|
|
548
556
|
const k = 1024;
|
|
@@ -1701,6 +1709,7 @@ ${opts.message || this.desc}`;
|
|
|
1701
1709
|
exports.adjustedInterval = adjustedInterval;
|
|
1702
1710
|
exports.arrayDiff = arrayDiff;
|
|
1703
1711
|
exports.blackOrWhite = blackOrWhite;
|
|
1712
|
+
exports.camelCase = camelCase;
|
|
1704
1713
|
exports.caseInsensitiveSort = caseInsensitiveSort;
|
|
1705
1714
|
exports.clean = clean;
|
|
1706
1715
|
exports.dec2Frac = dec2Frac;
|