typedash
Version:
modern, type-safe collection of utility functions
13 lines (11 loc) • 342 B
JavaScript
;
// src/functions/constantCase/constantCase.ts
function constantCase(string) {
if (!/[a-z]+/i.test(string)) {
return "";
}
return string.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toUpperCase();
}
exports.constantCase = constantCase;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.cjs.map