UNPKG

@qaflag/core

Version:

Base requirements for the QA Flag library

23 lines 932 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatUri = exports.camelToSnakeCase = exports.humanize = exports.titleize = void 0; const titleize = (str) => (0, exports.humanize)(str) .split(' ') .map(word => word.slice(0, 1).toUpperCase() + word.slice(1)) .join(' '); exports.titleize = titleize; const humanize = (str) => (0, exports.camelToSnakeCase)(str) .toLowerCase() .replace(/[_-]+/g, ' ') .replace(/\s{2,}/g, ' ') .trim(); exports.humanize = humanize; const camelToSnakeCase = (str) => str.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`); exports.camelToSnakeCase = camelToSnakeCase; const formatUri = (uri) => { const arr = uri.split(' '); const method = arr.shift(); return `${method === null || method === void 0 ? void 0 : method.toUpperCase()} ${arr.join(' ')}`; }; exports.formatUri = formatUri; //# sourceMappingURL=string.js.map