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

@lupucl/unid

v2.4.5

Published

A public TypeScript library to generate UUIDs. You can generate UUID4 and UUID5.

Downloads

8

Readme

unid

A public TypeScript library to generate UUIDs. You can generate UUID4 and UUID5.

Installation

Install unid with

  npm install @lupucl/unid
  yarn add @lupucl/unid (soon)

Usage/Examples

Generating UUIDs

import { unid } from '@lupucl/unid;

// Generating UUID4
const uuid4 = unid.generate4(); // e.g. 'd6339023-aa8e-4c52-a53d-f3f3f913b8c5'

// Generating UUID5
const name = 'Hello, world!';
// unid.generate5(namespace, name)
const uuid5 = unid.generate5(uuid4, name); //e.g 'cd6366d4-01cd-5948-97a2-3309017638fc'

// Generating UNID1
const unid1 = unid.v1(); //e.g '4de338f09b7f-19788-d2a75-259c-9b9a4f42c99c'

Validating a UUID/ UNID

//UUID4, UUID5 & UNID1
const isValid = unid.check(UUID); // true, can use UUID4, UUID5 and UNID1
const isInvalid = uuid.check('not-a-uuid'); // false

UUID Version 4:

UUID Version 4, also known as a random UUID, is a type of UUID that is generated using random numbers. According to the RFC 4122 specification, the UUID format consists of a randomly generated 128-bit value, which is then represented as a sequence of 32 hexadecimal digits, separated by hyphens into five groups. Version 4 UUIDs are designed to have a very low probability of collisions between two generated UUIDs.

UUID Version 5:

UUID Version 5, also known as a name-based UUID, is a type of UUID that is generated using a hash function based on a namespace and a name. According to the RFC 4122 specification, a UUID Version 5 is created by applying a SHA-1 hash function to a namespace UUID and a name. The resulting hash value is then used to generate a new UUID with a format similar to other UUID versions. UUID Version 5 is useful when a unique identifier is needed for a specific name within a particular namespace.

UNID Version 1 (new)

UNIDv1 is a unique identifier generator that produces a unique string of 38 characters, with a format of xxxxxxxxxxxx-1xxxx-xxxxx-xxxx-xxxxxxxxxxxx. Unlike UUIDs, UNIDs are not based on a standardized algorithm. Instead, they use a combination of the current time, a cryptographically secure random number generator, and a fixed prefix and suffix to generate a unique string. UNIDs are designed to be more secure than UUIDs because they use a cryptographically secure random number generator, which makes it much more difficult for an attacker to predict the next value in the sequence. UNIDs are useful when a unique identifier is needed for a specific application or use case.

License

This library is licensed under the MIT License.