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

@peopleware-pt/ciencia-id

v1.1.1

Published

Ciência ID check digit (ISO/IEC 7064 MOD 17,16) validation

Readme

@peopleware-pt/ciencia-id

Validation of the Ciência ID check digit (ISO/IEC 7064, MOD 17,16). Zero dependencies, Node 18+, TypeScript declarations included (parse returns a union narrowed by status).

Install

npm install @peopleware-pt/ciencia-id

Usage

const { isValid, parse, computeCheckDigit, normalize, format, SOURCES } = require("@peopleware-pt/ciencia-id");
// or: import { isValid, parse } from "@peopleware-pt/ciencia-id";

isValid("EA11-91C2-39D1");                 // true
computeCheckDigit("EA1191C239D");          // "1"  (11 hex digits in, check digit out; null if malformed)
normalize(" https://www.ciencia-id.pt/ea11-91c2-39d1\n"); // "EA1191C239D1"
format("ea1191c239d1");                    // "EA11-91C2-39D1"  (the check digit is not verified)
format("ea1191c239d1", true);              // "ciencia-id.pt/EA11-91C2-39D1"
parse("EA11-91C2-39D1");
// {
//   status: "CIENCIA_ID", reason: null, warnings: [],
//   internalValidation: "EA",
//   source: { code: "1", known: true, name: "Ciência ID", domain: "ciencia-id.pt" },
//   uniqueId: "191C239D", uniqueIdDecimal: 421274525,
//   checkDigit: "1", indicatedDomain: null
// }

Input is trimmed of ASCII whitespace, upper-cased (ASCII only), stripped of an optional http(s)://, www. and ciencia-id.pt/ or estudante-id.pt/ prefix, and stripped of -. Anything else (en dashes, no-break spaces, inner spaces, ligatures) is rejected as FORMAT.

Non-string input (numbers, arrays, Buffer, objects) is treated as invalid (FORMAT), like null.

Statuses

| status | Meaning | | --- | --- | | CIENCIA_ID | Well-formed, check digit correct, known source. | | UNKNOWN_SOURCE | Well-formed, check digit correct, but the source code (3rd digit) is not known to this library. It may be a typo that the check digit happened to miss, or the library may be out of date. | | INVALID | See reason: FORMAT (not 12 hex digits after normalisation) or CHECK_DIGIT (check digit mismatch). All other fields are null. |

CIENCIA_ID does not guarantee that the ID was ever issued, nor does it verify the internal validation digits; it only says the check digit is consistent.

DOMAIN_MISMATCH

warnings contains "DOMAIN_MISMATCH" when the input carried a domain prefix that differs from the domain of the ID's source (for example estudante-id.pt/EA11-91C2-39D1). The warning does not change status or isValid. For an unknown source, any domain prefix counts as a mismatch.

Historical note

The check-digit mechanism was designed for two identifiers: Ciência ID (in use, source 1) and Estudante-ID, which was never implemented, has no source code assigned and will not get one. The library is named after Ciência ID, but the algorithm also supports Estudante-ID, for historical reasons: the estudante-id.pt/ prefix is accepted on input and yields the DOMAIN_MISMATCH warning.

Known limitation

The check digit detects every single-character substitution, but not every adjacent transposition: at each position exactly one of the 120 possible pairs of distinct hex digits can be swapped undetected (about 1 in 120). In particular, swapping the last data digit and the check digit goes undetected when they are 0 and 1, so an ID ending in 01 and the same ID ending in 10 both validate (e.g. 1C11-C5F1-BC01 and 1C11-C5F1-BC10).

License

Apache-2.0. See LICENSE and NOTICE.