@technobuddha/library
Version:
A large library of useful functions
15 lines (14 loc) • 496 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUnderscoreCase = void 0;
/**
* Convert an identifier string to underscore case
*
* @param input The identifer string
* @returns the identifier in underscore case
*/
function toUnderscoreCase(input) {
return input.trim().replace(/[-_.\s]+\w/ug, function (c) { return "_" + c.slice(-1).toUpperCase(); }).toLowerCase();
}
exports.toUnderscoreCase = toUnderscoreCase;
exports.default = toUnderscoreCase;