convconv
Version:
Naming Conventions Converter
35 lines (34 loc) • 980 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConvConvImpl = void 0;
const camel_1 = require("./adapters/camel");
const adapter_1 = require("./adapters/adapter");
class ConvConvImpl {
constructor(name, adapter) {
this.name = name;
this.adapter = adapter;
}
toConvention(convention) {
const newAdapter = adapter_1.Adapters[camel_1.Camel.fromKebab(convention)];
return newAdapter.fromKebab(this.adapter.toKebab(this.name));
}
toKebab() {
return this.toConvention("kebab");
}
toCamel() {
return this.toConvention("camel");
}
toSnake() {
return this.toConvention("snake");
}
toPascal() {
return this.toConvention("pascal");
}
toScreamingKebab() {
return this.toConvention("screaming-kebab");
}
toScreamingSnake() {
return this.toConvention("screaming-snake");
}
}
exports.ConvConvImpl = ConvConvImpl;