UNPKG

bootstrap-vue-next

Version:

Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development

71 lines (70 loc) 2.02 kB
const require_constants = require("./constants-hccBP09R.js"); //#region src/utils/stringUtils.ts /** * @param str * @returns */ var startCase = (str) => str.replace(require_constants.RX_UNDERSCORE, " ").replace(require_constants.RX_LOWER_UPPER, (_, $1, $2) => `${$1} ${$2}`).replace(require_constants.RX_FIRST_START_SPACE_WORD, (_, $1, $2) => $1 + $2.toUpperCase()); /** * @param str * @returns */ var titleCase = (str) => str.replace(require_constants.RX_UNDERSCORE, " ").replace(require_constants.RX_LOWER_UPPER, (_, $1, $2) => `${$1} ${$2}`).replace(require_constants.RX_START_SPACE_WORD, (_, $1, $2) => $1 + $2.toUpperCase()); /** * Uppercases the first letter of a string and returns a new string * * @param str * @returns */ var upperFirst = (str) => { const trim = str.trim(); return trim.charAt(0).toUpperCase() + trim.slice(1); }; /** * Escapes a string for RegExp usage. * * @param str * @returns */ var escapeRegExp = (str) => str.replace(require_constants.RX_REGEXP_REPLACE, "\\$&"); /** * Escapes special chars in string and replaces * contiguous spaces with a whitespace match * * @param str * @returns */ var escapeRegExpChars = (str) => escapeRegExp(str).replace(require_constants.RX_SPACES, "\\s"); var toPascalCase = (str) => str.replace(/-./g, (match) => match.charAt(1).toUpperCase()).replace(/\b\w/g, (match) => match.toUpperCase()).replace(/\s+/g, ""); //#endregion Object.defineProperty(exports, "escapeRegExpChars", { enumerable: true, get: function() { return escapeRegExpChars; } }); Object.defineProperty(exports, "startCase", { enumerable: true, get: function() { return startCase; } }); Object.defineProperty(exports, "titleCase", { enumerable: true, get: function() { return titleCase; } }); Object.defineProperty(exports, "toPascalCase", { enumerable: true, get: function() { return toPascalCase; } }); Object.defineProperty(exports, "upperFirst", { enumerable: true, get: function() { return upperFirst; } }); //# sourceMappingURL=stringUtils-BwKOASdU.js.map