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

jsmigemo

v0.5.2

Published

migemo on javascript

Readme

jsmigemo

Node.js CI npm version

JavaScriptでMigemoを利用するためのライブラリ

Install from npm

$ npm install jsmigemo

Install from CDN

https://cdn.jsdelivr.net/npm/jsmigemo/dist/<filename><filename> の部分に、用途に応じて以下のファイル名を指定してください。

| Format | Default | Minified | |:------:|---------|----------| | ESModule | jsmigemo.mjs | jsmigemo.min.mjs | | CommonJS | jsmigemo.cjs | jsmigemo.min.cjs | | IIFE | jsmigemo.iife.js | jsmigemo.min.iife.js |

DefaultとMinifiedの違いは以下です。

  • Defaultは、ソースコードを1つにまとめただけの、変数名もそのまま残っているJSファイルです。開発時にはこちらをご利用ください。
  • Minifiedは、ファイルサイズを小さくするための様々な処理をしたJSファイルです。配布時にはこちらをご利用ください。

ESModuleとCommonJS、IIFEの違いは以下です。

  • ESModuleは、最近のバンドラやNode.JS、モダンブラウザなど幅広く利用できるフォーマットです。
  • CommonJSは、browserifyやwebpack1のような古いバンドラでの利用を意図したフォーマットです。
  • IIFEは、レガシーブラウザやESModuleの利用できない環境(例えばローカルのJSファイル)での利用を意図したフォーマットです。

HOW TO USE

CLI

$ npm install jsmigemo
$ jsmigemo
QUERY: kensaku
PATTERN: (kensaku|けんさく|ケンサク|建策|憲[作冊]|検索|献策|研削|羂索|kensaku|ケンサク)

Node.js

import { readFile } from "node:fs/promises";
import { CompactDictionary, Migemo } from "jsmigemo";

const data = await readFile("migemo-compact-dict");
const buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);

const dict = new CompactDictionary(buffer);
const migemo = new Migemo();
migemo.setDict(dict);

console.log(migemo.query("kensaku"));
//=> (kensaku|けんさく|ケンサク|建策|憲[作冊]|検索|献策|研削|羂索|kensaku|ケンサク)

Deno

import { CompactDictionary, Migemo } from "https://cdn.jsdelivr.net/npm/jsmigemo/dist/jsmigemo.min.mjs";

const data = await Deno.readFile("./migemo-compact-dict");
const dict = new CompactDictionary(data.buffer);
const migemo = new Migemo();
migemo.setDict(dict);

console.log(migemo.query("kensaku"));
//=> (kensaku|けんさく|ケンサク|建策|憲[作冊]|検索|献策|研削|羂索|kensaku|ケンサク)

Browser

<input id="queryInput" type="text" placeholder="kensaku">
<pre id="regexOutput"></pre>

<script src="https://cdn.jsdelivr.net/npm/jsmigemo/dist/jsmigemo.min.iife.js"></script>
<script>
  const DICT_URL = "https://cdn.jsdelivr.net/npm/jsmigemo/migemo-compact-dict";

  const queryInput = document.getElementById("queryInput");
  const regexOutput = document.getElementById("regexOutput");

  let migemo = null;

  async function setup() {
    const response = await fetch(DICT_URL);
    if (!response.ok) {
      throw new Error(`HTTP ${response.status}`);
    }

    const buffer = await response.arrayBuffer();
    const dict = new window.jsmigemo.CompactDictionary(buffer);
    migemo = new window.jsmigemo.Migemo();
    migemo.setDict(dict);
  }

  queryInput.addEventListener("input", () => {
    if (!migemo) {
      return;
    }
    regexOutput.textContent = migemo.query(queryInput.value.trim());
  });

  setup().catch((error) => {
    regexOutput.textContent = `辞書の読み込みに失敗: ${error.message}`;
  });
</script>

辞書ファイルの生成

> node  bin/jsmigemo-dict.mjs <text-dict-file> <compact-dict-file>

<text-dict-file> は、C/Miemoで使われているテキスト形式の辞書ファイルです。 <compact-dict-file> は、出力ファイル名です。

ライセンス

本ライブラリに付属の辞書ファイルは、MITライセンスのプロジェクトから生成されています。 yet-another-migemo-dict

本プロジェクト配下のファイルは、MIT LICENSEのもとで配布します。