# pinyinizer

> Add pinyin tone diacritics to a string

Latest version **0.1.2** (published 2016-03-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install pinyinizer
pnpm add pinyinizer
yarn add pinyinizer
bun add pinyinizer
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-03-13 |
| First published | 2016-03-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jens Östlund |
| Maintainers | iensu |
| Keywords | pinyin, string, chinese, tone, diacritics |

## Links

- npm: https://www.npmjs.com/package/pinyinizer
- Repository: https://github.com/iensu/pinyinizer
- Homepage: https://github.com/iensu/pinyinizer#readme
- Issues: https://github.com/iensu/pinyinizer/issues
- npm.io page: https://npm.io/package/pinyinizer

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2016-03-13
- 0.1.1 — 2016-03-13

## README

# Pinyinizer

Adds proper (Mandarin) Chinese tone diacritics to a string.

The four tones of Chinese are commonly represented by the numbers 1-4. This module enables one to take a string with numerical tone representation and transforming it into a string with proper tone diacritics.

| Numeric | Tone Diacritic | Description |
| ------- | -------------- | ----------- |
| ma1     | mā             | level       |
| ma2     | má             | rising      |
| ma3     | mǎ             | dipping     |
| ma4     | mà             | falling     |
| ma      | ma             | neutral     |

## Installation

NPM:

```
npm install --save pinyinizer
```

Bower:

```
bower install --save pinyinizer
```

## API

### `pinyinize(s: string): string`

Returns a pinyinized string where all tone indicator numbers have been replaced with tone diacritics on the vowels.

## Usage

### NodeJS

```javascript
const pinyinizer = require('pinyinizer');

let pinyinized = pinyinizer.pinyinize('ni3hao3 shi4jie4!');

console.log(pinyinized) // nĭhăo shìjiè!
```

### Browser

In the browser, _pinyinizer_ is exposed as `Pinyinizer`:

```
var pinyinized = Pinyinizer.pinyinize('ni3hao3 shi4jie4!');

console.log(pinyinized) // nĭhăo shìjiè!
```

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