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

@alizeait/uuid

v2.0.3

Published

A fast and tiny RFC compliant uuid v4 generator

Downloads

12

Readme

@alizeait/uuid Check Coverage

A tiny (~260B) and super fast RFC4122 compliant v4 UUID generator.

Supports both Nodejs and Browser environments while using native cryptography features.

Includes ESM and Commonjs/Nodejs bundles. Allows bundlers like Webpack and Rollup to pick the correct bundle for different environments.

Check out the playground

Installation

$ npm install @alizeait/uuid

Usage

import { v4 } from "@alizeait/uuid";

v4(); //  'dc8c63d6-55e0-49be-9d68-19b0e51be2a6'
v4(); //  'e3f68a1e-d22b-4c94-bc6b-78b44c1608f3'

Benchmarks

uuid/v4               x 1,006,107 ops/sec ±1.04% (82 runs sampled)
@alizeait/uuid        x 4,262,898 ops/sec ±0.98% (87 runs sampled)
nanoid                x 1,779,066 ops/sec ±1.58% (91 runs sampled)


RFC UUID v4 validation:

uuid/v4               ✔
@alizeait/uuid        ✔
nanoid                ✘

Running on Node.js v12.13.0, 64-bit OS, Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 16.0 GB RAM

Why is @alizeait/uuid so fast?

It first fills a large(6144 bytes) Uint8Array typed array buffer with cryptographically strong random values using the browser/nodejs crypto API(Meaning that it fills an array buffer randomly with numbers between 0 and 255). It then generates an array of 2 digit hexadecimal numbers(length=256) and starts slicing off chunks from the buffer as needed, meaning that each buffer is able to supply 384 v4 UUID random invocations. When the buffer is all used up, it generates a new one with the crypto APIs and iterates.

This caching mechanism allows for faster composition and generation of the uuids.