Tabnine Logo For Javascript
pinyin
Code IndexAdd Tabnine to your IDE (free)

How to use
pinyin
function
in
pinyin

Best JavaScript code snippets using pinyin.pinyin(Showing top 2 results out of 315)

origin: arthurkiller/electronic-QQ

static isValidNameHint(nameHint, userName) {
  const pinyinRaw = pinyin(userName, {
   style: pinyin.STYLE_FIRST_LETTER,
  });

  let pinyinName = '';
  for (const py of pinyinRaw) {
   if (py[0] && py[0] !== ' ') {
    pinyinName += py[0];
   }
  }

  const nameRe = new RegExp(nameHint[1], 'ig');
  return nameRe.test(userName) || nameRe.test(pinyinName);
 }
origin: kslr/telegram-aqi-bot

bot.onText(/\/aqi (.+)/, (msg, match) => {
 let city = match[1];
 const re = /[^\u4e00-\u9fa5]|[\uFE30-\uFFA0]/;
 if (!re.test(city)) {
  city = pinyin(city, {
   segment: true,
   style: pinyin.STYLE_NORMAL,
  });
  city = city.join('');
 }

 console.log(`query ${city} city`);
 request(`http://aqicn.org/aqicn/json/android/${city}/json`, (error, response, body) => {
  if (!error && response.statusCode === 200) {
   const res = JSON.parse(body);
   if (res.wgt) {
    console.log(res.wgt);
    bot.sendPhoto(msg.chat.id, res.wgt);
   }
  } else {
   console.error(error);
  }
 });
});
pinyin(npm)pinyin

Most used pinyin functions

  • STYLE_FIRST_LETTER
  • STYLE_NORMAL

Popular in JavaScript

  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • chalk
    Terminal string styling done right
  • crypto
  • lodash
    Lodash modular utilities.
  • semver
    The semantic version parser used by npm.
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • commander
    the complete solution for node.js command-line programs
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • mime-types
    The ultimate javascript content-type utility.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now