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

rfc8107-js

v1.0.0

Published

JavaScript implementation of RFC 8107 for Advertising Digital Identifiers (Ad-IDs)

Readme

rfc8107-js

A JavaScript implementation of RFC 8107 for Advertising Digital Identifiers (Ad-IDs) with full RFC compliance.

npm version License: MIT

Features

  • RFC 8107 Compliant - Fully compliant with the official specification
  • 🌐 Universal - Works with Node.js, Bun, and Deno
  • 📦 Dual Package - Supports both ESM and CommonJS
  • 🔒 TypeScript - Includes TypeScript declarations
  • 🎯 Zero Dependencies - Lightweight with no external dependencies
  • Fast - Optimized for performance

Installation

# npm
npm install rfc8107-js

# yarn  
yarn add rfc8107-js

# pnpm
pnpm add rfc8107-js

# bun
bun add rfc8107-js

Usage

ESM (ES Modules)

import { generateAdId, isValidAdId, validateAdId } from 'rfc8107-js';

// Generate a standard Ad-ID URN
const standardId = generateAdId();
console.log(standardId); // urn:adid:ABCD1234567

// Generate a High Definition Ad-ID URN  
const hdId = generateAdId({ isHD: true });
console.log(hdId); // urn:adid:ABCD1234567H

// Validate an Ad-ID URN
console.log(isValidAdId('urn:adid:ABCD1234567')); // true
console.log(isValidAdId('urn:adid:0BCD1234567')); // false (starts with 0)

// Get detailed validation results
const result = validateAdId('urn:adid:0BCD1234567');
console.log(result); 
// { isValid: false, error: 'Company prefix cannot start with 0' }

CommonJS

const { generateAdId, isValidAdId, validateAdId } = require('rfc8107-js');

const adId = generateAdId();
console.log(isValidAdId(adId)); // true

Deno

import { generateAdId, isValidAdId } from 'https://esm.sh/rfc8107-js';

const adId = generateAdId();
console.log(isValidAdId(adId)); // true

API Reference

generateAdId(options?): string

Generates an RFC 8107 compliant Ad-ID URN.

Parameters:

  • options (optional): Configuration object
    • isHD (boolean): Whether this is a High Definition asset (adds 'H' suffix)

Returns: A valid Ad-ID URN string

isValidAdId(urn: string): boolean

Validates an Ad-ID URN according to RFC 8107.

Parameters:

  • urn (string): The URN to validate

Returns: true if valid, false otherwise

validateAdId(urn: string): ValidationResult

Validates an Ad-ID URN with detailed error information.

Parameters:

  • urn (string): The URN to validate

Returns: Object with isValid boolean and optional error message

RFC 8107 Specification

The Ad-ID URN format follows: urn:adid:[4-char-prefix][7-char-code][optional-H-suffix]

  • Company Prefix: 4 characters, first character must be A-Z or 1-9 (not 0)
  • Asset Identifier: 7 alphanumeric characters (A-Z, 0-9)
  • HD Suffix: Optional 'H' for High Definition assets

Examples

  • Standard: urn:adid:ABCD1234567
  • High Definition: urn:adid:ABCD1234567H

Testing

# Run all tests
npm test

# Test specific runtime
npm run test:node    # Node.js
npm run test:bun     # Bun  
npm run test:deno    # Deno
npm run test:jest    # Jest (legacy)

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

License

MIT © kyungw00k

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Related

Changelog

1.0.0

  • Initial release
  • RFC 8107 compliant implementation
  • Universal runtime support (Node.js, Bun, Deno)
  • TypeScript declarations
  • Comprehensive validation with detailed error messages