Note: This package can NOT deal the heteronym(aka. 多音字) very well.
$ npm install sort-by-pinyin
var sort = require('sort-by-pinyin');
console.log(sort(['上海', '北京', '杭州', '长沙']));
// ==> [ '北京', '长沙', '杭州', '上海' ]
Note: This package can NOT deal the heteronym(aka. 多音字) very well.
$ npm install sort-by-pinyin
var sort = require('sort-by-pinyin');
console.log(sort(['上海', '北京', '杭州', '长沙']));
// ==> [ '北京', '长沙', '杭州', '上海' ]