UNPKG

@technobuddha/library

Version:
15 lines (14 loc) 496 B
"use strict"; 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;