@geronimus/uuid
v0.1.2
Published
Generates the string representation of a random (variant 4) RFC 4122 UUID.
Downloads
1
Readme
uuid()
Generates a Universally Unique Identifier, based on variant 4 (random) of the Internet Engineering Task Force (IETF) Request for Comments (RFC) 4122 proposal.
Specifically, this function generates its canonical string representation.
Examples
const uuid = require( "@geronimus/uuid" );
console.log( uuid() );
// Expected output:
// => "8afe0169-17a2-4091-8375-30ca1d4333ab" (Or similar.)
const id1 = uuid();
const id2 = uuid();
if ( id1 === id2 )
console.log( "It's an impossible coincidence!" );
else
console.log( "Each value is unique." );
Notes
The randomness of this function depends on Math.random()
. Therefore, it MUST NOT be used for any purpose requiring cryptographic security.