UNPKG

hangul-romanize

Version:
26 lines (25 loc) 855 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FormatUtil = void 0; var constants_1 = require("../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 constants_1.Format.CAPITALIZED: return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); case constants_1.Format.UPPERCASE: return str.toUpperCase(); case constants_1.Format.LOWERCASE: return str.toLowerCase(); default: return str; } }; return FormatUtil; }()); exports.FormatUtil = FormatUtil;