Package Exports
- sorted-joyo-kanji
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sorted-joyo-kanji) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sorted-joyo-kanji 
Sorted array of joyo-kanji
Installation
npm:
npm install sorted-joyo-kanji
Usage
var assert = require('power-assert')
var joyoKanji = require('sorted-joyo-kanji')
var each = require('amp-each')
var codePoint = require('code-point')
describe('JoyoKanjiTest', () => {
it('array length check', () => {
var kanji = joyoKanji.kanji
var codepoint = joyoKanji.codepoint
assert(kanji.length === 2136)
assert(codepoint.length === 2136)
})
it('array sort check', () => {
var codepoint = joyoKanji.codepoint
each(codepoint, (item, index) => {
if (index < codepoint.length - 1) {
assert(codepoint[index] < codepoint[index + 1])
}
})
})
it('isJoyo', () => {
assert(joyoKanji.isJoyo('聡') === false)
assert(joyoKanji.isJoyo('明') === true)
assert(joyoKanji.isJoyo('推') === true)
assert(joyoKanji.isJoyo('敲') === false)
})
})
API
sorted-joyo-kanji.kanji
kanji
— Sorted array of the Joyo Kanji.["一","丁","七","万","丈","三","上","下","不","与","且","世", ...]
sorted-joyo-kanji.codepoint
codepoint
— Sorted array of UTF-16-encoded code point number.[19968,19969,19971,19975,19976,19977,19978,19979,19981, ...]
sorted-joyo-kanji.isJoyo(value)
- Joyo Kanji check using sorted codepoint array and binary search.
Parameters
value
— a kanji character.