# is-japanese

> is-japanese is a library helps you to check if a string only contains Japanese characters.

Latest version **1.0.3** (published 2021-05-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-japanese
pnpm add is-japanese
yarn add is-japanese
bun add is-japanese
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-05-26 |
| First published | 2021-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yuetian Li |
| Maintainers | liyt96 |
| Keywords | npm, japanese, string, character, unicode |

## Links

- npm: https://www.npmjs.com/package/is-japanese
- Repository: https://github.com/liyt96/is-japanese
- Homepage: https://github.com/liyt96/is-japanese#readme
- Issues: https://github.com/liyt96/is-japanese/issues
- npm.io page: https://npm.io/package/is-japanese

## 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

- 1.0.3 (latest) — 2021-05-26
- 1.0.2 — 2021-05-26
- 1.0.1 — 2021-05-23
- 1.0.0 — 2021-05-23

## README

# is-japanese

[![Build Status](https://travis-ci.com/liyt96/is-japanese.svg?branch=main)](https://travis-ci.com/liyt96/is-japanese)

An npm library checks if the content *only* contains Japanese characters. Returns ``true`` if a 
given string only contains Japanese characters, ``false`` if it contains non-Japanese characters.

## Install

```
npm i is-japanese
```

## Usage

```
var isJapanese = require("is-japanese");
console.log(isJapanese("東京")) // true
console.log(isJapanese("東京Japan")) // false
```

This library tolerates Hiragana, Katakana, Kanji, common half and full Japanese punctuations, 
common Japanese symbols, and number 0-9.

The general standard is based on modern Japanese phrasings we read in online paltforms like Yahoo 
Japan. More examples from Yahoo News inculde:

```
var isJapanese = require("is-japanese");
console.log(isJapanese("新型コロナ対策は「評価する」が25.2％だったのに対して「評価しない」は71.5％。")) // true
console.log(isJapanese("朝日で63％、共同では83％、NHKは68.7％に達している。")) // false, 'NHK' are not Japanese characters
```

## Benchmark

Device: MacBook Pro (Retina, 13-inch, Early 2015)

Node: v12.13.1

```
isJapanese("今夜の月は綺麗ですね") x 7,530,755 ops/sec ±21.34% (37 runs sampled)
isJapanese("ss今夜の月は綺麗ですね") x 20,593,769 ops/sec ±19.35% (34 runs sampled)
isJapanese("今夜の月は綺麗ですねss") x 10,912,107 ops/sec ±58.65% (33 runs sampled)
isJapanese(chars1000) true x 45,771 ops/sec ±24.30% (30 runs sampled)
isJapanese(chars1001) false x 232,222 ops/sec ±30.26% (26 runs sampled)
```

## Ackowledgement

This project is heavily based on the [is-chinese](https://github.com/alsotang/is-chinese) library.

## License

MIT

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