convconv
Version:
Naming Conventions Converter
23 lines (22 loc) • 723 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConvention = void 0;
const constants_1 = require("./constants");
const is_operations_1 = require("./is.operations");
const errors_1 = require("./errors");
function getConvention(name) {
const convention = constants_1.CONVENTIONS.reduce((prev, convention) => {
if (prev !== null) {
return prev;
}
if (is_operations_1.IS_OPERATIONS.isConvention(convention, name)) {
return convention;
}
return null;
}, null);
if (convention === null) {
throw new errors_1.ConventionNotFoundError();
}
return convention;
}
exports.getConvention = getConvention;