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

hapin-utils

v5.0.0

Published

Hapin JavaScript(TypeScript) 开放工具包

Readme

hapin-utils

TypeScript utilities for Hapin, Kazakh Arabic/Cyrillic letters, and broad IPA_CNA.

Version

This documentation targets hapin-utils 5.0.0, with the context-v1 segmentation rules and compatibility wrappers for existing applications.

npm install [email protected]

For migration from 4.x, review the compatibility notes below and CHANGELOG.md. Source-letter conversion is corrected in both API families; existing Hapin wrappers retain legacy segmentation.

New API

import { analyzeHapin, convert } from 'hapin-utils'

analyzeHapin('arzangha').units.filter(u => u.kind === 'letter').map(u => u.id)
// ['a', 'r', 'z', 'a', 'n', 'gh', 'a']

convert('арзанға', { from: 'cyrillic', to: 'arabic' }).text
// ارزانعا

convert('shanghai', { from: 'hapin', to: 'arabic' }).text
// شاڭحاي

convert supports Hapin→Arabic/IPA_CNA, Arabic→Hapin/IPA_CNA, and Cyrillic→Hapin/Arabic/IPA_CNA. Other directions return status: 'error' and text: null.

The new API preserves whitespace, quoted literals, unknown characters and ordinary zero-width characters. It does not generate hidden boundary markers. Select inputFormat: 'legacy-boundaries' only when importing old machine-separated Hapin.

rules: 'context-v1' (default) ranks ngh as n+gh, with source-attested word-form exceptions such as shanghai. ngul and ngye keep competing analyses. status: 'ambiguous' has a preferred text plus bounded local alternatives; alternatives each replace one conflict, not every possible combination. maxCandidates is 1–64 (default 8, including the preferred path). Truncation is reported.

errors: 'strict' rejects warning diagnostics, including unresolved segmentation, unclosed quotes and unknown characters. Inspect diagnostics and losses: simplified Hapin cannot preserve every source spelling distinction. Spans are UTF-16 [start,end) offsets.

You may pass an analysis to convert(analysis, { from: analysis.source, to: 'arabic' }). To render a different candidate, replace units with a returned alternative's units; the original diagnostics remain available.

Existing functions

The seven transform* functions and three Array functions retain their signatures. They now share the structured source parser and word-local renderers. Hapin wrappers retain legacy segmentation: transformHapinToArabic('ngh') remains ڭح; use convert for the context rules.

clean=false keeps old U+200B serialization. transformArabicToHapin(input, clean, easy) additionally retains the legacy apostrophe display mode. Apostrophes are not a new input-boundary syntax. Array interfaces split that old serialization; use analyzeHapin().units for explicit letter units.

Source-boundary, quote, front-vowel and word-scope bugs are fixed even through the wrappers. Unknown y is preserved instead of silently discarded. These corrections can change previously incorrect output.

Development

pnpm test
pnpm typecheck
pnpm docs:generate
pnpm check

docs-data/api-examples.json is generated from the built package and checked for staleness. The website consumes a fixed snapshot with the same package version, release channel and rules version. releaseStatus: 'stable' identifies the version channel; it does not indicate whether npm publication has already occurred. Raw desktop dictionaries are not included in the package or required by CI.

Release

Generate versioned documentation with pnpm docs:generate, authenticate with npm login --auth-type=web --registry=https://registry.npmjs.org/, then run pnpm publish:check and npm publish --dry-run. prepublishOnly first verifies the npm identity and listed maintainer, then runs the test, type, build, documentation and package-entry checks. Token-specific write scope and 2FA are still checked by npm during actual publication; a dry-run alone cannot prove those permissions. The actual publication is a separate npm publish command, run by the maintainer after reviewing the package contents. See docs/releasing.zh-CN.md for the release checklist.