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

alpha-deca

v1.1.0

Published

A lightweight JavaScript library for generating random alphanumeric strings and characters

Downloads

2

Readme

Alpha Deca

A lightweight JavaScript library for generating random alphanumeric strings and characters. Perfect for creating IDs, tokens, passwords, or any random string needs.

Features

  • 🚀 Lightweight: No dependencies, minimal footprint
  • 🔧 ES6 Modules: Modern JavaScript with import/export support
  • 🎲 Random Generation: Cryptographically secure random characters
  • 📦 NPM Ready: Easy to install and use in any Node.js project
  • 🎯 Simple API: Clean, intuitive function names

Installation

npm install alpha-deca

Quick Start

import { randomString, randomChar, getAlphanumericChars } from 'alpha-deca';

// Generate a random 8-character string
const id = randomString(8);
console.log(id); // e.g., "A7bK9mN2"

// Generate a single random character
const char = randomChar();
console.log(char); // e.g., "X", "5", "z"

// Get all available alphanumeric characters
const chars = getAlphanumericChars();
console.log(chars); // ['0', '1', '2', ..., '9', 'A', 'B', ..., 'Z', 'a', 'b', ..., 'z']

API Reference

getAlphanumericChars()

Returns an array containing all alphanumeric characters (0-9, A-Z, a-z).

Returns: string[] - Array of alphanumeric characters

import { getAlphanumericChars } from 'alpha-deca';

const chars = getAlphanumericChars();
// Returns: ['0', '1', '2', ..., '9', 'A', 'B', ..., 'Z', 'a', 'b', ..., 'z']

randomChar()

Generates a single random alphanumeric character.

Returns: string - A single random character (0-9, A-Z, a-z)

import { randomChar } from 'alpha-deca';

const char = randomChar();
// Returns: "A", "5", "z", etc.

randomString(length)

Generates a random string of specified length using alphanumeric characters.

Parameters:

  • length (number) - The length of the string to generate

Returns: string - A random string of the specified length

import { randomString } from 'alpha-deca';

// Generate different length strings
const shortId = randomString(4);    // e.g., "K9mN"
const mediumId = randomString(8);   // e.g., "A7bK9mN2"
const longId = randomString(16);    // e.g., "X5kL8mN2pQ9rS3tU"

randomNumber(length)

Generates a random string of specified length using only numeric characters (0-9).

Parameters:

  • length (number) - The length of the string to generate

Returns: string - A random numeric string of the specified length

import { randomNumber } from 'alpha-deca';

const num = randomNumber(6);
// Returns: "847392"

const shortNum = randomNumber(2);
// Returns: "45"

Use Cases

Generate Unique IDs

import { randomString } from 'alpha-deca';

const userId = randomString(12);
const sessionId = randomString(16);
const orderId = randomString(8);

Create Temporary Passwords

import { randomString } from 'alpha-deca';

const tempPassword = randomString(10);
console.log(`Your temporary password is: ${tempPassword}`);

Generate API Keys

import { randomString } from 'alpha-deca';

const apiKey = randomString(32);
console.log(`API Key: ${apiKey}`);

Create Random Tokens

import { randomString } from 'alpha-deca';

const resetToken = randomString(24);
const verificationCode = randomString(6);

Generate Numeric Codes

import { randomNumber } from 'alpha-deca';

const pinCode = randomNumber(4);        // e.g., "8473"
const orderNumber = randomNumber(8);    // e.g., "56715382"
const verificationCode = randomNumber(6); // e.g., "123456"

Browser Usage

This package works in modern browsers that support ES6 modules:

<script type="module">
  import { randomString } from 'https://unpkg.com/[email protected]/app.js';
  
  const id = randomString(8);
  console.log(id);
</script>

Development

Prerequisites

  • Node.js >= 14.0.0

Setup

git clone https://github.com/decagondev/alpha-deca.git
cd alpha-deca
npm install

Available Scripts

npm test      # Run tests
npm run lint  # Lint code
npm run format # Format code

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

1.0.0

  • Initial release
  • Added getAlphanumericChars() function
  • Added randomChar() function
  • Added randomString() function
  • Added randomNumber() function

Support

If you encounter any issues or have questions, please open an issue on GitHub.


Made with ❤️ for the JavaScript community