@rpearce/simple-uniqueid
v0.1.1
Published
Generate simple unique ids
Downloads
1,047
Readme
simple-uniqueid
Generate simple unique ids.
This small package relies on Math.random().toString(16).slice(-4)
to generate
32 unique characters with an optional string prefix.
Note: This is not a replacement for a real crypto library but is intended for
small-batch use (like HTML id
attributes).
Links
Installation
$ npm i @rpearce/simple-uniqueid
or
$ yarn add @rpearce/simple-uniqueid
Usage
import uniqueId from 'simple-uniqueid'
uniqueId() // "177dc3d88508b9f8bd2e69982a7d03b8"
uniqueId('myPrefix-') // "myPrefix-64f8fca9b3d96c98a267ba58cf0f9eb8"
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!