typedash
Version:
modern, type-safe collection of utility functions
11 lines (10 loc) • 323 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();
}
export { constantCase };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-OBYW7MIA.js.map