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 🙏

© 2024 – Pkg Stats / Ryan Hefner

notunid

v2.0.1

Published

A package for generating unique IDs

Downloads

23

Readme

notunid

A simple and reliable package for generating unique IDs. Useful for any project where unique identifiers are needed.

Installation

You can install the package using npm:

npm install notunid

Usage

const { randomIdGenerate, randomTextGenerate, randomNumber, randomChoice, randomShuffle } = require('notunid');

// Generate a unique ID of length 12
// Argument is optional, default length = 12
const uniqueId = randomIdGenerate(12);
console.log(`Generated Unique ID: ${uniqueId}`);

// Generate a unique ID with an invalid length (default length will be used)
const invalidUniqueId = randomIdGenerate("invalid");
console.log(`Generated Unique ID with default length: ${invalidUniqueId}`);

// Generate a random text string of length 8
// Argument is optional, default length = 10
const randomText = randomTextGenerate(8);
console.log(`Generated Random Text: ${randomText}`);

// Generate a random text string with an invalid length (default length will be used)
const invalidRandomText = randomTextGenerate("invalid");
console.log(`Generated Random Text with default length: ${invalidRandomText}`);

/** Version 2 new functions */

//=============Generate a random number starts============
// Desc: Generate a random number within a specified range
// Argument is optional, default range = 10

// different use case
//= no value provided - default values get used
const randomNum = randomNumber();
console.log("No value: "+ randomNum)

//= spcified range
const randomNum = randomNumber(10,20);
console.log("Specified: "+ randomNum)

//= one value - one value becomes end value
const randomNum = randomNumber(27);
console.log("One value: "+ randomNum)

//= same value - returns same value
const randomNum = randomNumber(7,7);
console.log("Same: "+ randomNum)

//= float value -returns base 10
const randomNum = randomNumber(5.6,15.6);
console.log("Float: "+ randomNum)

//===========Generate a random number ends============


//=========== Get a random value from an array starts ============

const choiceArray = [1, 2, 3, 4, 5];
const randomChoiceValue = randomChoice(choiceArray);
console.log(`Random Choice from Array: ${randomChoiceValue}`);

//=========== Get a random value from an array emds ============



// ========Get a shuffled array from an array start =============

const shuffleArray = [1, 2, 3, 4, 5];
const shuffledArray = randomShuffle(shuffleArray);
console.log(`Shuffled Array: ${shuffledArray}`);

// ========Get a shuffled array from an array ends =============

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes or improvements.