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

gen-unique-ids

v1.0.1

Published

Generate Unique id and generate customised unique id

Downloads

25

Readme

gen-unique-ids

gen-unique-ids is a JavaScript utility for generating unique IDs with customizable options. It provides a simple way to create random IDs with varying lengths, including capital letters, small letters, numbers, and symbols.

Installation

import { genUniqueId } from "https://cdn.jsdelivr.net/gh/webdeveloper-sandeep/repository-version-control/gen-unique-ids/[email protected]";

[!WARNING]
Must include type="module" in script tag

<script src="script.js" type="module"></script>

2) You can install gen-unique-ids via npm:

install in terminal

npm i gen-unique-ids

use in file

const genUniqueId = require("gen-unique-ids");

how to use

  • if you just call the function

code

genUniqueId();

result

dTe2hJRBK2F1A8ampXJY; //A unique ID of length 20 every time
  • You can pass the length of the ID.

code

genUniqueId(12);
genUniqueId(5);

result

gGUdd272Oq3Y; //A unique ID of length 12 every time
mG3Fg; //A unique ID of length 5 every time
  • You can customize letter symbols and numbers in id by sending an object as an argument

code

const data = {
  length: 14, // Pass the length; by default, it is 20
  symbol: true, // Do you want to add symbols to the unique ID?
  lowercase: true, // Do you want to add lowercase letter to the unique ID?
  uppercase: true, // Do you want to add uppercase letter to the unique ID?
  number: true, // Do you want to add number to the unique ID?
};

genUniqueId(data);

result

2BOE@3fIfWp0u& // Generate a unique ID of length 14 each time, which includes lowercase letters, uppercase letters, numbers, and symbols
  • Create unique IDs like this: 0776UEeE-2442-8Y30-3585-GB4uo8nH

code

const data = {
  length: [8, 4, 4, 4, 8], // you can customise it
};

genUniqueId(data);

result

0776UEeE-2442-8Y30-3585-GB4uo8nH
  • Create unique IDs like this fh03j86h {customSeparator} PchR {customSeparator} TR6qgtkI using custom separator

code

const data = {
  length: [8, 4, 8],
  separate: "+", // By default, it is '-',
};

genUniqueId(data);

result

fh03j86h + PchR + TR6qgtkI;
  • Generate random ID with custom symbols

code

const data = {
  length: 13,
  symbol: "!@#", // If you set it to true by default, it becomes '!@#$%&'
};

genUniqueId(data);

result

u45D@T8N2#Ox4
  • Create unique IDs like this:
    24132-eizspf-7iA (num)-(lowercase)-(any) </pre

code

const data = {
  length: [5, "number", 6, "lowercase", 3], // first 5 digits are only number next 6 digits are only lowercase and last 3 digits can be number , lowercase and uppercase
};

genUniqueId(data);

result

24132-eizspf-77A

[!TIP] "number" --- for Number "uppercase" --- for Uppercase letter "lowercase" --- for Lowercase letter "letter" --- for both uppercase and lowercase "symbol" --- for symbols

#creater