# js-pinyin

> 汉字转换拼音，需要es6语法(let、class等)支持，不依赖其他组件

Latest version **0.2.7** (published 2024-07-17) · MIT License license · 0 weekly downloads

## Install

```sh
npm install js-pinyin
pnpm add js-pinyin
yarn add js-pinyin
bun add js-pinyin
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2024-07-17 |
| First published | 2017-03-13 |
| Weekly downloads | 0 |
| License | MIT License |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 177.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 97 |
| Maintainers | waterchestnut |
| Keywords | pinyin, 拼音, 首字母, 汉语拼音, 汉字, es6 |

## Links

- npm: https://www.npmjs.com/package/js-pinyin
- Repository: https://github.com/waterchestnut/pinyin
- Homepage: https://github.com/waterchestnut/pinyin#readme
- Issues: https://github.com/waterchestnut/pinyin/issues
- npm.io page: https://npm.io/package/js-pinyin

## Recent versions

- 0.2.7 (latest) — 2024-07-17
- 0.2.6 — 2024-07-16
- 0.2.5 — 2023-08-30
- 0.2.4 — 2023-05-19
- 0.2.3 — 2023-05-19
- 0.2.2 — 2023-05-19
- 0.2.1 — 2023-05-19
- 0.2.0 — 2023-05-19
- 0.1.9 — 2017-03-13
- 0.1.6 — 2017-03-13
- 0.1.3 — 2017-03-13
- 0.1.2 — 2017-03-13
- 0.1.1 — 2017-03-13

## README

# 汉字转拼音
把汉字转化为拼音字母，由[chinalu/JSPinyin](https://github.com/chinalu/JSPinyin)改写，使用新语法并去掉mootools的依赖

## 安装
```base
npm install js-pinyin

import pinyin from 'js-pinyin'
```

## 使用示例
```js
let pinyin = require('js-pinyin');

pinyin.setOptions({checkPolyphone: false, charCase: 0});

console.log(pinyin.getFullChars('管理员'))
console.log(pinyin.getCamelChars('管理员'))
console.log(pinyin.getCamelChars('1234'))
console.log(pinyin.getCamelChars('english'))
console.log(pinyin.getCamelChars('昕'))
console.log(pinyin.getCamelChars('佛'))
console.log(pinyin.getFullChars('佛'))
console.log(pinyin.getFullChars('凃一二'))
console.log(pinyin.getCamelChars('凃一二'))
```

---
_Source: https://npm.io/package/js-pinyin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
