npm install pinyin-or-hanzi
import getType from 'pinyin-or-hanzi'
console.log(getType('wo3 de mao1 xi3huan3 he2 niu3nai3'))
// pinyin-numbered
console.log(getType('wǒ de māo xǐhuǎn hé niǔnǎi'))
// pinyin-marked
console.log(getType('ㄨㄛˇ ㄉㄜ˙ ㄇㄠ ㄒㄧˇ ㄏㄨㄢˇ ㄏㄜˊ ㄋㄧㄡˇ ㄋㄞˇ'))
// zhuyin
console.log(getType('我的猫喜欢喝牛奶'))
// mandarin
console.log(getType('this is not chinese at all!'))
// other
pinyin-utils
pinyin-split
find-hanzi
hsk-words
cedict
mdbg
hanzi-to-pinyin
pinyin-convert
pinyin-rest
pinyin-api
pinyin-bot-core
pinyin-telegram
pinyin-messenger
pinyin-line
pinyin-chrome
pinyin-cli
hanzi-cli
If you have a question, found a bug or want to propose a feature, have a look at the issues page.