New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

myanmar-sort

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myanmar-sort

Sort Myanmar / Burmese words

latest
Source
npmnpm
Version
2.1.0
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

myanmar-sort

Sorting Myanmar / Burmese text is hard! This uses a big JSON tree to help you quickly sort in Node.js

If you are sorting names on server or client, use the myanmar-names library instead! It will remove prefixes before passing them to this module.

Usage

If you are on the client-side, don't load this huge library! Use new Intl.Collator("my-MM") instead!

Node.js only (expect long download time)

npm install myanmar-sort
var myanmarSort = require("myanmar-sort");

place1 = 'ရခိုင်ပြည်နယ်';
place2 = 'ရန်ကုန်တိုင်းဒေသကြီး';
place3 = 'ရှမ်းပြည်နယ်';
[place1, place2, place3].sort(myanmarSort);

You can also pass a function to retrieve the text that you sort by:

states = [
  { name: 'ရခိုင်ပြည်နယ်' },
  { name: 'ချင်းပြည်နယ်' },
  { name: 'ရှမ်းပြည်နယ်' }
];
states.sort(myanmarSort(function (state) {
  return state.name;
}));

Contributions and bugs

The JSON tree isn't complete! Please let me know if you find bugs, and add mocha tests to test/index.js

License

Open source under an MIT license

Keywords

myanmar

FAQs

Package last updated on 05 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts