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