khmer-date-utils
Version:
This package is used to convert date to khmer date, date range, date utils
29 lines • 924 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToKhmerNumber = ToKhmerNumber;
/**
* Converts a number to its Khmer numeral representation.
* @param input - The number or numeric string to convert.
* @returns The Khmer numeral representation of the input.
*/
function ToKhmerNumber(input) {
// Define the mapping of Arabic numerals to Khmer numerals
const arabicToKhmerMap = {
'0': '០',
'1': '១',
'2': '២',
'3': '៣',
'4': '៤',
'5': '៥',
'6': '៦',
'7': '៧',
'8': '៨',
'9': '៩',
};
// Convert the input to a string
const inputString = String(input);
// Replace each digit with its Khmer equivalent
const khmerNumber = inputString.replace(/\d/g, (digit) => arabicToKhmerMap[digit] || digit);
return khmerNumber;
}
//# sourceMappingURL=khmer-number.js.map