UNPKG

hangul-romanize

Version:
23 lines (22 loc) 699 B
import { Format } from "../constants"; var FormatUtil = /** @class */ (function () { function FormatUtil() { } FormatUtil.fromString = function (str, format) { if (typeof str !== 'string') { throw new Error('typeof str should be a string'); } switch (format) { case Format.CAPITALIZED: return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); case Format.UPPERCASE: return str.toUpperCase(); case Format.LOWERCASE: return str.toLowerCase(); default: return str; } }; return FormatUtil; }()); export { FormatUtil };