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

@mommo-codes/barkod

v0.1.2

Published

GTIN parsing, canonicalisation, match keys and GS1 classification. Compiled from Rust to WebAssembly.

Readme

@mommo-codes/barkod

GTIN parsing, canonicalisation, match keys and GS1 classification. Written in Rust, compiled to WebAssembly — the same implementation the Rust crate and the Python package run, so all three give the same answers.

Scoped because npm rejects the bare name barkod as too similar to marked. The crate and the Python package are unscoped.

npm install @mommo-codes/barkod

The scoped package starts at 0.1.1; there is no 0.1.0 on npm.

import * as barkod from "@mommo-codes/barkod";

await barkod.init(); // loads the wasm once, at start-up

barkod.storeForm("7350053850019"); // "07350053850019" — padded, check digit kept
barkod.storeForm("lek");           // "lek"            — untouched, never blanked
barkod.key("7350053850019");       // "07350053850010"
barkod.key("073905259077450");     // undefined        — 15 digits is not a GTIN

const p = barkod.parse("370245100000000123");
p.isGtin;  // false
p.reason;  // "too_long"
p.message; // "More than 14 digits — not a GTIN"
p.raw;     // "370245100000000123" — always kept

Every function throws until init() resolves, rather than returning a placeholder. A library that quietly answered wrongly while warming up would be a worse version of the bug this one exists to remove.

The domain

Every function agrees that a GTIN is 8 to 14 digits and differs only on what it does inside that range. Outside it, storeForm hands the input back untouched and key returns undefined. A lossy transformation is not a licence to be more permissive about what counts as a GTIN.

The key is not a GTIN

key() returns a branded GtinKey, not a plain string. It will not assign into a Gtin14String, so the compiler refuses the mistake this library was written to end: writing a match key into a column that holds GTINs. Roughly nine in ten keys end in a check digit no product has.

const k = barkod.key("7390525907745");
const g: barkod.Gtin14String = k; // ✗ does not compile

The brand is compile-time only, so it protects typed slots rather than untyped ones — type your GTIN columns and the guard works.

Full documentation: https://github.com/mommo-codes/barkod

MIT licensed.