How to use the pinyin.compare function in pinyin

To help you get started, we’ve selected a few pinyin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DIYgod / RSSHub / docs / format.js View on Github external
.sort((a, b) => {
                const ia = isASCII(a.title[0]);
                const ib = isASCII(b.title[0]);
                if (ia && ib) {
                    return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1;
                } else if (ia || ib) {
                    return ia > ib ? -1 : 1;
                } else {
                    return pinyin.compare(a.title, b.title);
                }
            })
            .map((x) => x.content.join('\n'))

pinyin

汉语拼音转换工具。

MIT
Latest version published 4 months ago

Package Health Score

70 / 100
Full package analysis