japanese-characters
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/japanese-characters package

1.1.0 • Public • Published

japanese-characters

Analyze strings to detect if they contain Japanese characters.

Detects Hiragana and Katakana characters.

Installation

npm install japanese-characters

Usage

The module exports an object with three values:

  • hiragana, an array of all the Hiragana characters
  • katakana, an array of all the Katakana characters
  • presentIn(inputString), a function that returns a Boolean indicating whether the given inputString contains Japanese characters
const japaneseCharacters = require('japanese-characters')
 
console.log(japaneseCharacters.presentIn('ブートキャンプ')
// true
 
console.log(japaneseCharacters.presentIn('some English string')
// false

Ordered by Frequency

To make searching more efficient, the characters are sorted by frequency of use. This order was determined by counting the number of each characters in the Japanese Wikipedia Corpus.

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

  • lodash: Lodash modular utilities.
  • tap: A Test-Anything-Protocol library for JavaScript

License

MIT

Package Sidebar

Install

npm i japanese-characters

Weekly Downloads

3,080

Version

1.1.0

License

MIT

Unpacked Size

5.54 kB

Total Files

7

Last publish

Collaborators

  • zeke