Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.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'))