parse-openapi
Version:
OpenAPI v3 parser
20 lines (19 loc) • 678 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getServiceName = void 0;
const camelcase_1 = __importDefault(require("camelcase"));
/**
* Convert the input value to a correct service name. This converts
* the input string to PascalCase.
*/
const getServiceName = (value) => {
const clean = value
.replace(/^[^a-zA-Z]+/g, '')
.replace(/[^\w\-]+/g, '-')
.trim();
return (0, camelcase_1.default)(clean, { pascalCase: true });
};
exports.getServiceName = getServiceName;