ordinalize logic
否定後方参照置換によりconverterを使用可能。冗長な条件分岐なし。
how to use ordinalize
define Number.prototype
1. returnreturn(this+`th`).replace(/(?<!1)[123]th$/,v=>`1th`===v?`1st`:`2th`===v?`2nd`:`3rd`)return(this+`th`).replace(/(?<!1)[123]th$/,v=>`1th`===v?`1st`:`2th`===v?`2nd`:`3rd`)