npm.io
1.0.0 • Published 6 years ago

@tpp/simple-uuid

Licence
ISC
Version
1.0.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
Stars
2

Simple UUID

This is a simple UUID generator that has zero dependencies and works everywhere.

Usage

Install it first:

__CODE_BLOCK_0__gt; npm i @tpp/simple-uuid

Then use it to generate a simple and unique id:

let uuid = require('@tpp/simple-uuid')
uuid()
// '3insalcl'
uuid(100)
//'mw8kcgh739zhjs5g2lujpiv1ey2jv8onr4olzvgxishd8k6vv6fm8bycvixlbux4651qg8vxt26srcnxbw08sexutbir5rjbnwko'

It detects NodeJS’s crypto module, or the browsers crypto functionality where available and falls back to Math.random if needed.

Keywords