UNPKG

@dipscope/type-manager

Version:

Transform JSON strings or plain objects into JS class instances.

17 lines 521 B
import { getWords } from '../functions/get-words'; export class SnakeUpperCaseNamingConvention { convert(name) { return getWords(name).reduce(this.reduce, ''); } reduce(result, word, index) { if (word.length === 0) { return result; } const wordUpperCased = word.toUpperCase(); if (index === 0) { return wordUpperCased; } return `${result}_${wordUpperCased}`; } } //# sourceMappingURL=snake-upper-case-naming-convention.js.map