Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sorted-joyo-kanji

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sorted-joyo-kanji

Sorted array of the Joyo Kanji

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sorted-joyo-kanji js-standard-style

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.

License

MIT

Keywords

FAQs

Package last updated on 19 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc