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

@credentum/parse-cusip

v0.0.1

Published

Validate and parse CUSIP identifiers — issuer, issue, check digit, CINS, Treasury detection. Zero dependencies.

Readme

parse-cusip

Validate and parse CUSIP identifiers (Committee on Uniform Securities Identification Procedures). Returns structured data: issuer, issue number, check digit, CINS detection, and security type classification.

Installation

npm install @credentum/parse-cusip

Usage

import { parseCUSIP } from '@credentum/parse-cusip';

const result = parseCUSIP('037833100');
// => {
//   raw: '037833100',
//   valid: true,
//   issuer: '037833',
//   issue: '10',
//   checkDigit: '0',
//   computedCheckDigit: '0',
//   isCINS: false,
//   isTreasury: false,
//   securityType: 'equity'
// }

Quick Validation

import { isValidCUSIP } from '@credentum/parse-cusip';

isValidCUSIP('037833100'); // true  (Apple)
isValidCUSIP('68389X106'); // false (bad check digit)

Compute a Check Digit

import { computeCheckDigit } from '@credentum/parse-cusip';

computeCheckDigit('03783310'); // '0' (Apple)
computeCheckDigit('17275R10'); // '2' (Cisco)

Why Use This?

Every fintech team working with US/Canadian securities encounters CUSIPs. The standard response is to copy-paste a gist or inline a validation function from Rosetta Code. There is no standalone, zero-dependency npm package that parses CUSIPs into structured data.

parse-cusip gives you:

  • Validation via the ANSI X9.6 Modulus 10 Double Add Double algorithm
  • Parsing that extracts issuer, issue number, check digit, and security type
  • CINS detection (Committee on Uniform Security Identification Procedures International Numbering System — foreign securities)
  • Treasury detection (US government securities starting with 9128/9127)
  • Zero dependencies, pure TypeScript, <2KB

API

parseCUSIP(cusip: string): CUSIPResult

Parse a 9-character CUSIP string into structured data.

Parameters:

  • cusip — A 9-character CUSIP string (digits, uppercase letters, *, @, #)

Returns: CUSIPResult

interface CUSIPResult {
  raw: string;              // Original input
  valid: boolean;           // Whether check digit is correct
  issuer: string;           // Characters 1-6 (issuer code)
  issue: string;            // Characters 7-8 (issue number)
  checkDigit: string;       // Character 9 (provided check digit)
  computedCheckDigit: string; // What the check digit should be
  isCINS: boolean;          // True if first character is a letter (foreign security)
  isTreasury: boolean;      // True if issuer starts with 9128 or 9127
  securityType: 'equity' | 'debt' | 'unit' | 'unknown';
}

isValidCUSIP(cusip: string): boolean

Returns true if the CUSIP has a valid format and correct check digit.

computeCheckDigit(cusip8: string): string

Compute the check digit for an 8-character CUSIP (without check digit). Returns a single digit character.

Test Vectors

| CUSIP | Company | Valid | |-------|---------|-------| | 037833100 | Apple Inc. | yes | | 17275R102 | Cisco Systems | yes | | 38259P508 | Google (Alphabet) | yes | | 594918104 | Microsoft | yes | | 68389X105 | Oracle | yes | | 68389X106 | Oracle (bad check) | no |

License

MIT