Skip to content

Instantly share code, notes, and snippets.

@seanghay
Last active October 16, 2022 15:16
Show Gist options
  • Save seanghay/26e7d8293d3285f2984dd411b87d471a to your computer and use it in GitHub Desktop.
Save seanghay/26e7d8293d3285f2984dd411b87d471a to your computer and use it in GitHub Desktop.
Convert Khmer Numerals to ASCII
const km2ascii = (s) =>[...s].reduce((p,c)=>p+(c=c.charCodeAt(0),String.fromCharCode(c-(c>=6112&&c<=6121?6064:0))),'')
km2ascii('1234abc១២៣៤')
// => '1234abc1234'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment