A NodeJS module with three features:
- Sort a list of Myanmar / Burmese names according to official alphabetic order
- Remove prefixes from Myanmar / Burmese names
- Find possible matches for a Myanmar / Burmese name using some matching rules from a large dataset
Client-side use is possible, but throws an error if your user does not have Intl or Myanmar locale support.
Removes prefixes and sorts by official alphabetic order (yes, you will need a library for this, not .sort())
On the client-side, this library uses Intl.Collator (available in modern browsers) or throws an error if it's not available. An error is also thrown if the Myanmar locale is not available for sorting. Use a try-catch block.
On the server, you can compile NodeJS with full locale support (
brew reinstall node --with-full-icu), follow instructions on how to add more locales to your current install with
npm install -g full-icu or use the myanmar-sort module (included in package.json).
npm test on this repo and it will print whether it uses the myanmar-sort or Intl.Collator sort.
In NodeJS, put this first:
var myanmarNameSort = sort;
Pass an array of names:
var names = "ဦးလှမြင့်" "ဦးမော";tryoutput = ;catch e// fallbackoutput = names;> "ဦးမော" "ဦးလှမြင့်"
Pass an array of objects, and a function to extract the name:
Returns the names most likely to match a given name. Removes prefixes, and looks at commonly mistaken and missing letters (like ထ and လ, ဂ and ဝ, commonly missed ီ)
Pass a name string, and an array of potential matches, receive sorted list of best matches:
Passing a function to extract the names:
On NodeJS, use this format:
var myanmarNameMatch = match;
Prefixes from Wikipedia under a Creative Commons license
Open Sourced with an MIT License