UNPKG

read-vietnamese-number

Version:

Đọc số thành chữ trong Tiếng Việt

39 lines (38 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReadingConfig = exports.NotEnoughUnitError = exports.InvalidNumberError = exports.InvalidFormatError = exports.RvnError = void 0; class RvnError extends Error { } exports.RvnError = RvnError; class InvalidFormatError extends RvnError { } exports.InvalidFormatError = InvalidFormatError; class InvalidNumberError extends RvnError { } exports.InvalidNumberError = InvalidNumberError; class NotEnoughUnitError extends RvnError { } exports.NotEnoughUnitError = NotEnoughUnitError; class ReadingConfig { constructor() { this.separator = ' '; this.unit = ['đơn', 'vị']; this.negativeSign = '-'; this.pointSign = '.'; this.thousandSign = ','; this.periodSize = 3; this.filledDigit = '0'; this.digits = ['không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín']; this.units = [[], ['nghìn'], ['triệu'], ['tỉ'], ['nghìn', 'tỉ'], ['triệu', 'tỉ'], ['tỉ', 'tỉ']]; this.negativeText = 'âm'; this.pointText = 'chấm'; this.oddText = 'lẻ'; this.tenText = 'mười'; this.hundredText = 'trăm'; this.oneToneText = 'mốt'; this.fourToneText = 'tư'; this.fiveToneText = 'lăm'; this.tenToneText = 'mươi'; } } exports.ReadingConfig = ReadingConfig;