@api3/contracts
Version:
Contracts through which API3 services are delivered
23 lines • 834 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUpperSnakeCase = toUpperSnakeCase;
exports.toLowerKebabCase = toLowerKebabCase;
function toUpperSnakeCase(input) {
return input
.replaceAll(/[^\d\sA-Za-z]+/g, ' ') // replace each non-alphanumeric character with a space
.replaceAll(/\s+/g, ' ') // replace consecutive spaces with a single space
.trim()
.split(' ')
.join('_')
.toUpperCase();
}
function toLowerKebabCase(input) {
return input
.replaceAll(/[^\d\sA-Za-z]+/g, ' ') // replace each non-alphanumeric character with a space
.replaceAll(/\s+/g, ' ') // replace consecutive spaces with a single space
.trim()
.split(' ')
.join('-')
.toLowerCase();
}
//# sourceMappingURL=strings.js.map