Skip to content

pepebecker/pinyin-or-hanzi

Repository files navigation

Pinyin or Hanzi

npm version Travis Build Status dependency status dev dependency status ISC-licensed

Install

npm install pinyin-or-hanzi

Usage

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

Related

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.