npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ja-pitch-accent

v1.2.0

Published

Pitch accent lookup and HTML formatting extracted from 10ten Japanese Reader

Readme

ja-pitch-accent

Standalone pitch-accent lookup and HTML formatting extracted from 10ten Japanese Reader.

Completely vibe-coded. Use at your own discretion!

CLI

npx ja-pitch-accent <spelling> [reading] [--html]

For example, to get a JSON array (see below), run:

npx ja-pitch-accent 閉める

To print HTML instead:

npx ja-pitch-accent 閉める --html | head -n 1

When there are multiple dictionary entries, we print one per line. We use head -n 1 in this example to only print the first.

JavaScript API

Installation

npm install ja-pitch-accent

Usage

import { formatJaPitchAccentHtml, getJaPitchAccent } from 'ja-pitch-accent';

const matches = getJaPitchAccent('閉める', 'しめる');
const html = formatJaPitchAccentHtml(matches[0]);

getJaPitchAccent(spelling, reading?) takes a Japanese word, and optionally a reading to narrow the results to a specific reading. It returns an array of matches. The first match is usually the best.

type JaPitchAccentMatch = {
  accent: number;
  partOfSpeech: string[];
  reading: string;
  spellings: string[];
};

accent is the pitch-accent downstep position counted in mora:

  • 0 means heiban.
  • 1 means atamadaka.
  • 2 or greater means the pitch drops after that mora.
  • If accent === mora count, the pattern is odaka.

formatJaPitchAccentHtml(match, renderCharacter?) renders the same binary pitch-accent outline style used by 10ten. The optional renderCharacter(character, index) callback can return custom HTML for each kana character.

CSS variables:

  • --ja-pitch-accent-border-color
  • --ja-pitch-accent-border-style
  • --ja-pitch-accent-border-width
  • --ja-pitch-accent-display
  • --ja-pitch-accent-margin-bottom

Browser use

This package can be used in the browser as-is. However, your bundle size will be several megabytes, as the entire dataset JSON is included.

Contributing

Data

To rebuild the dataset from 10ten, run:

git submodule update --init --recursive
pnpm run build-data

By default that reads from the vendored 10ten submodule at vendor/10ten-ja-reader/data/words.ljson, but you can also pass an explicit source path and output directory to scripts/build-dataset.ts.

Licensing

The package code is GPL-3.0-only.

The bundled generated dataset also carries upstream attribution/licence notices from the data sources used by 10ten, including JMdict/EDICT and pitch-accent data attributed by 10ten to Uros Ozvatic/Kanjium. See NOTICE.