Gathering detailed insights and metrics for @lukeed/uuid
Gathering detailed insights and metrics for @lukeed/uuid
Gathering detailed insights and metrics for @lukeed/uuid
Gathering detailed insights and metrics for @lukeed/uuid
A tiny (~230B)and fast UUID (V4) generator for Node and the browser
npm install @lukeed/uuid
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.6
Supply Chain
99.4
Quality
75.3
Maintenance
100
Vulnerability
100
License
JavaScript (94.89%)
HTML (5.11%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
407 Stars
44 Commits
12 Forks
4 Watchers
3 Branches
1 Contributors
Updated on Jun 25, 2025
Latest Version
2.0.1
Package Id
@lukeed/uuid@2.0.1
Unpacked Size
9.54 kB
Size
3.92 kB
File Count
11
NPM Version
8.19.2
Node Version
18.12.1
Published on
Mar 31, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A tiny (~230B) and fast UUID (v4) generator for Node and the browser.
This module offers two modes for your needs:
@lukeed/uuid
Math.random
to produce UUIDs.@lukeed/uuid/secure
crypto
module.Important:
Version1.0.0
only offered a "secure" implementation.
Inv2.0.0
, this is now exported as the"@lukeed/uuid/secure"
entry.
Additionally, this module is preconfigured for native ESM support in Node.js with fallback to CommonJS. It will also work with any Rollup and webpack configuration.
$ npm install --save @lukeed/uuid
There are two "versions" of @lukeed/uuid
available:
@lukeed/uuid
Size (gzip): 231 bytes
Availability: CommonJS, ES Module, UMD
Relies on Math.random
, which means that, while faster, this mode is not cryptographically secure.
Works in Node.js and all browsers.
@lukeed/uuid/secure
Size (gzip): 235 bytes
Availability: CommonJS, ES Module, UMD
Relies on the environment's crypto
module in order to produce cryptographically secure (CSPRNG) values.
Works in all versions of Node.js. Works in all browsers with crypto.getRandomValues()
support.
1import { v4 as uuid } from '@lukeed/uuid'; 2import { v4 as secure } from '@lukeed/uuid/secure'; 3 4uuid(); //=> '400fa120-5e9f-411e-94bd-2a23f6695704' 5uuid(); //=> 'cd6ffb4d-2eda-4c84-aef5-71eb360ac8c5' 6 7secure(); //=> '8641f70e-8112-4168-9d81-d38170bfa612' 8secure(); //=> 'd175fabc-2a4d-475f-be56-29ba8104c2f2'
Returns: string
Creates a new Version 4 (random) RFC4122 UUID.
Running on Node.js v12.18.4
Validation:
✔ String.replace(Math.random)
✔ String.replace(crypto)
✔ uuid/v4
✔ @lukeed/uuid
✔ @lukeed/uuid/secure
Benchmark:
String.replace(Math.random) x 381,358 ops/sec ±0.31% (93 runs sampled)
String.replace(crypto) x 15,842 ops/sec ±1.16% (86 runs sampled)
uuid/v4 x 1,259,600 ops/sec ±0.45% (91 runs sampled)
@lukeed/uuid x 6,384,840 ops/sec ±0.22% (95 runs sampled)
@lukeed/uuid/secure x 5,439,096 ops/sec ±0.23% (98 runs sampled)
Running on Chrome v85.0.4183.121
Validation:
✔ String.replace(Math.random)
✔ uuid/v4
✔ @lukeed/uuid
✔ @lukeed/uuid/secure
Benchmark:
String.replace(Math.random) x 313,213 ops/sec ±0.58% (65 runs sampled)
uuid/v4 x 302,914 ops/sec ±0.94% (64 runs sampled)
@lukeed/uuid x 5,881,761 ops/sec ±1.29% (62 runs sampled)
@lukeed/uuid/secure x 852,939 ops/sec ±0.88% (65 runs sampled)
The reason why this UUID.V4 implementation is so much faster is two-fold:
The @lukeed/uuid/secure
module maintains an internal ArrayBuffer of 4096 bytes, which supplies 256 uuid.v4()
invocations. However, the default module preallocates 256 invocations using less memory upfront. Both implementations will regenerate its internal allocation as needed.
A larger buffer would result in higher performance over time, but I found this to be a good balance of performance and memory space.
MIT © Luke Edwards
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More