@dipscope/type-manager
Version:
Transform JSON strings or plain objects into JS class instances.
21 lines • 757 B
JavaScript
import { getWords } from '../functions/get-words';
var KebabCaseNamingConvention = (function () {
function KebabCaseNamingConvention() {
}
KebabCaseNamingConvention.prototype.convert = function (name) {
return getWords(name).reduce(this.reduce, '');
};
KebabCaseNamingConvention.prototype.reduce = function (result, word, index) {
if (word.length === 0) {
return result;
}
var wordLowerCased = word.toLowerCase();
if (index === 0) {
return wordLowerCased;
}
return "".concat(result, "-").concat(wordLowerCased);
};
return KebabCaseNamingConvention;
}());
export { KebabCaseNamingConvention };
//# sourceMappingURL=kebab-case-naming-convention.js.map