Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@rpearce/simple-uniqueid

rpearce828BSD-30.1.1

Generate simple unique ids

uniqueid, id, id-generator

readme

simple-uniqueid

All Contributors npm version npm downloads Build Status Coverage Status Maintainability

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).

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):


Robert Pearce

💻 📖 💡 🤔 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[0.1.1] - 2019-12-29

Changed

  • moved API docs to readme
  • bumped devDependencies
  • moved src/index.js to be just at index.js
  • changed license from ISC to BSD-3

[0.1.0] - 2018-12-29

Added

  • all the things