hangul-romanize
Version:
Romanize Hangul
23 lines (22 loc) • 699 B
JavaScript
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 };