Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 2.38 KB

README.md

File metadata and controls

58 lines (44 loc) · 2.38 KB

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.