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

@datadayrepos/js-id-web

v0.0.2

Published

Utils for generating identifiers in javascript browser environment. Using web crypto engine for random number generation.

Readme

js-id-web

Utils for generating identifiers in javascript browser environment. Using web crypto engine for random number generation.

🚀 Content

  • XIDs: ....
  • UID: ....
  • Timebased: Timestamo with a twist - increments with an integer if duplicates in the same ms.
  • Random: Returns x number of chars based on your input.
  • Random Crockford: Returns random nased on Crockford UI sensitive library.

🛠 Usage

pnpm i @datadayrepos/js-id-web

💻 Code

import { UUID as _UUID, } from '@datadayrepos/js-id-web'

// Function to generate a UUID
export function UUID(): string {
  const { error, result } = _UUID()
  if (error)
    throw new Error('Failed to generate UUID')

  return result
}
import { generateXID as _generateXID } from '@datadayrepos/js-id-web'

// Function to generate a new XID. It returns a promise that resolves with the next ID.
export async function generateXID(): Promise<string> {
  const xidGenerator = await _generateXID()
  const id = xidGenerator.next()
  if (!id)
    throw new Error('Failed to generate XID')

  return id
}
import { genTimeId } from '@datadayrepos/js-id-web'

const id = genTimeId()
import { randomString as _randomString } from '@datadayrepos/js-id-web'

/**
 * Generates a pseudo-random string of a specified length using characters from a predefined charset.
 *
 * In environments like Node.js and the web, this method leverages more cryptographically secure
 * randomization mechanisms, making the generated strings more random and harder to predict.
 *
 * NOTE: Even in Node.js and the web, while the method is more secure than in GAS, it may not meet the
 * standards of high-security applications. Always assess your security requirements and consider
 * using dedicated cryptographic methods if robust security is a necessity.
 *
 * @param {number} keys - Length of the desired random string.
 */
export function randomString(length: number = 32): string {
  const { error, result } = _randomString(length)
  if (error)
    throw new Error('Failed to generate random string')

  return result
}
import { randomCrockford as _randomCrockford } from '@datadayrepos/js-id-web'

/**
 * Generates a pseudo-random string of a specified length using Crockford's Base32 character set.
 * This character set omits visually similar characters like 'i', 'l', 'o', and 'u' to minimize confusion,
 * making it easier for human reading and transcription.
 *
 * In environments like Node.js and the web, this method leverages more cryptographically secure
 * randomization mechanisms, making the generated strings more random and harder to predict.
 *
 * NOTE: Even with these mechanisms, the method may not meet the standards required for high-security
 * applications. Always assess your security requirements and consider using dedicated cryptographic
 * methods if robust security is a necessity.
 *
 * The Crockford's Base32 character set is especially useful in contexts where strings are manually
 * entered or read by humans, as it reduces the risk of errors due to misreading or misinterpreting
 * characters.
 *
 * @param {number} keys - Length of the desired random string.
 * @returns {object} An object with an error field (null if no error) and a result field containing the generated string.
 */
export function randomCrockford(length: number = 12): string {
  const { error, result } = _randomCrockford(length)
  if (error)
    throw new Error('Failed to generate Crockford encoded string')

  return result
}
import { generateSecureRandomPin as _generateSecureRandomPin } from '@datadayrepos/js-id-web'

/**
 * Generates a cryptographically secure random numeric PIN of the specified length.
 *
 * This method uses Web Crypto API in browsers or Node.js crypto module to provide robust security.
 * It is suitable for generating one-time passwords (OTP), verification codes, or numeric tokens.
 *
 * @param {number} length - The length of the PIN to generate. Defaults to 6.
 * @returns {Promise<{ error: string | null, result: string | null }>} An object with an error message if any, and the generated numeric PIN.
 */
export function generateSecureRandomPin(length: number = 6): string {
  const { error, result } = _generateSecureRandomPin(length)
  if (error)
    throw new Error('Failed to generate Crockford encoded string')

  return result
}
import { generateSecureRandomBase64 as _generateSecureRandomBase64 } from '@datadayrepos/js-id-web'

/**
 * Generates a cryptographically secure random 32-byte value and returns it as a base64 encoded string.
 *
 * This method uses Web Crypto API in browsers or Node.js crypto module to provide robust security.
 * It is suitable for generating keys or tokens that require high levels of randomness and security.
 *
 * @returns {Promise<{ error: string | null, result: string | null }>} An object with an error message if any, and the base64 encoded random string.
 */
export function generateSecureRandomBase64(length: number = 32): string {
  const { error, result } = _generateSecureRandomBase64(length)
  if (error)
    throw new Error('Failed to _generateSecureRandomBase64 encoded string')

  return result
}

🔗 Links

📄 License

Prop License © 2023 Ivar Strand

www.abyrint.com