@dothq/id
TypeScript icon, indicating that this package has built-in type declarations

1.0.1Β β€’Β PublicΒ β€’Β Published

@dothq/id

πŸ†” Simple unique ID generator for databases, users and anything that needs identifying.

Zero dependencies, 333 bytes in size

This library utilises Date.now() and Math.random(), so you should rarely encounter duplicates.

I have tested ~300,000 generated IDs and not one has been a duplicate.

Install

$ yarn add @dothq/id

Usage

import { useID } from "@dothq/id";

const id = useID(); // 111hx2yprxlfasiwzvj7dzoaywioijwjg

const idWithRounds = useID(2); // y6m188bb12xsg9uoj

useID(rounds?: number) => string

  • rounds?: number - default: 4

Readme

Keywords

none

Package Sidebar

Install

npm i @dothq/id

Weekly Downloads

1

Version

1.0.1

License

MPL-2.0

Unpacked Size

17.9 kB

Total Files

7

Last publish

Collaborators

  • enderdev