
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
A lightweight JavaScript library for generating random alphanumeric strings and characters
A lightweight JavaScript library for generating random alphanumeric strings and characters. Perfect for creating IDs, tokens, passwords, or any random string needs.
npm install alpha-deca
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']
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 generateReturns: 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 generateReturns: 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"
import { randomString } from 'alpha-deca';
const userId = randomString(12);
const sessionId = randomString(16);
const orderId = randomString(8);
import { randomString } from 'alpha-deca';
const tempPassword = randomString(10);
console.log(`Your temporary password is: ${tempPassword}`);
import { randomString } from 'alpha-deca';
const apiKey = randomString(32);
console.log(`API Key: ${apiKey}`);
import { randomString } from 'alpha-deca';
const resetToken = randomString(24);
const verificationCode = randomString(6);
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"
This package works in modern browsers that support ES6 modules:
<script type="module">
import { randomString } from 'https://unpkg.com/alpha-deca@1.0.0/app.js';
const id = randomString(8);
console.log(id);
</script>
git clone https://github.com/decagondev/alpha-deca.git
cd alpha-deca
npm install
npm test # Run tests
npm run lint # Lint code
npm run format # Format code
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
getAlphanumericChars() functionrandomChar() functionrandomString() functionrandomNumber() functionIf you encounter any issues or have questions, please open an issue on GitHub.
Made with ❤️ for the JavaScript community
FAQs
A lightweight JavaScript library for generating random alphanumeric strings and characters
We found that alpha-deca demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.