GithubHelp home page GithubHelp logo

Comments (2)

zh-lx avatar zh-lx commented on July 28, 2024

感谢反馈,因为对于非汉字来说是没有 initial 的,所以现在的结果可以说对也不对。
针对你提的这个 issue 的需求,可以通过 pinyin-pro v3.12.0 版本中的 type: 'all' 配置实现:

const { pinyin } = require('pinyin-pro');

const result = pinyin('foo/汉字/bar/123', {
  type: 'all',
  toneType: 'none',
}).map((item) => (item.isZh ? item.initial : item.origin));

console.log(result);

/* result
[
'f', 'o', 'o', '/',
'h', 'z', '/', 'b',
'a', 'r', '/', '1',
'2', '3'
]
*/

type: 'all' 选项会返回转换的完整信息,可以参考:获取完整内容

from pinyin-pro.

taoqf avatar taoqf commented on July 28, 2024

all 非常好用。感谢

from pinyin-pro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.