number-master

web application to practice korean numbers
git clone git://brookjeynes.dev/bjeynes/number-master.git
Log | Files | Refs | README | LICENSE

time.js (585B)


      1 import { nativeStringFromNumber } from "./native.js";
      2 
      3 /**
      4  * @param {number} num
      5  * @returns {string}
      6  */
      7 export function hourStringFromNumber(num) {
      8 	const str = nativeStringFromNumber(num);
      9 
     10 	// Irregulars
     11 	if (str.startsWith("하나")) return "한" + str.slice(2);
     12 	if (str.startsWith("둘")) return "두" + str.slice(1);
     13 	if (str.startsWith("셋")) return "세" + str.slice(1);
     14 	if (str.startsWith("넷")) return "네" + str.slice(1);
     15 	if (str.startsWith("열하나")) return "열한" + str.slice(3);
     16 	if (str.startsWith("열둘")) return "열두" + str.slice(2);
     17 
     18 	return str;
     19 }