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

usfm3

v0.1.5

Published

An error-tolerant [USFM 3.x](https://docs.usfm.bible/usfm/3.1.1/index.html) parser for JavaScript and TypeScript. Outputs [USJ](https://docs.usfm.bible/usfm/3.1.1/usj/index.html) (JSON), [USX](https://docs.usfm.bible/usfm/3.1.1/usx/index.html) (XML), norm

Downloads

282

Readme

usfm3

An error-tolerant USFM 3.x parser for JavaScript and TypeScript. Outputs USJ (JSON), USX (XML), normalized USFM, and vref format (a key-value map of verse references to text).

Built in Rust and compiled to WebAssembly. Works in browsers, Node.js, Deno, and Bun.

Also available as a Rust crate and Python package.

Installation

npm install usfm3

Usage

WASM is automatically initialized in Node.js, Deno, and Bun. In a browser, call init() first:

import init from "usfm3";
await init(); // browser only

Then parse USFM text:

import { parse } from "usfm3";

const result = parse(usfmText);

if (result.hasErrors()) {
    console.error("Document has errors");
}

// Output formats (lazy — only serialized when called)
const usj = result.toUsj();    // USJ object
const usx = result.toUsx();    // USX XML string
const usfm = result.toUsfm();  // Normalized USFM string
const vref = result.toVref();  // Vref pairs like { "GEN 1:1": "In the beginning...", ... }

// Diagnostics
for (const d of result.diagnostics) {
    console.log(`[${d.severity}] ${d.message} (${d.start}..${d.end})`);
    // d.code is a machine-readable string like "UnknownMarker", "ImplicitClose", etc.
}

// Skip semantic validation
const result2 = parse(usfmText, { validate: false });

// Free WASM memory when done
result.free();

API

parse(usfm: string, options?: ParseOptions): ParseResult

Parse a USFM string. Returns a ParseResult with lazy output methods and diagnostics.

ParseOptions:

| Field | Type | Default | Description | |---|---|---|---| | validate | boolean | true | Run semantic validation after parsing |

ParseResult

| Method / Property | Returns | Description | |---|---|---| | toUsj() | object | USJ (Unified Scripture JSON) | | toUsx() | string | USX (Unified Scripture XML) | | toUsfm() | string | Normalized USFM | | toVref() | Record<string, string> | Verse reference to plain text map | | hasErrors() | boolean | True if any error-severity diagnostics | | diagnostics | Diagnostic[] | Parser and validation diagnostics | | free() | void | Free WASM memory |

Diagnostic

| Property | Type | Description | |---|---|---| | severity | string | "error", "warning", or "info" | | code | string | Machine-readable code (e.g. "UnknownMarker") | | message | string | Human-readable message | | start | number | Start byte offset in source | | end | number | End byte offset in source |

License

MIT