fast-unique-id
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

fast-unique-id

fast-unique-id is a super lightweight package written in typescript that allows you generate universal unique identifier (non-standard) in 18 characters.

Installation

npm i fast-unique-id

Usage

import * as uniqueID from 'fast-unique-id';
 
console.log(uniqueID.fast());
//68kUVYfj05caqmg0PL
 
console.log(uniqueID.timestamp());
//68kUVYk4gw9lp3ENRP

Format & Performance

Method Length Format Performance (Ryzen 5 1600)
uniqueID.fast() 18 pid + prefix + timestamp + random suffix 1904761 ops/sec
uniqueID.timestamp() 18 pid + prefix + init timestamp + offset + random suffix 916590 ops/sec

Collision

  • multi thread safe
  • no collision risk under 1000 ids/sec on average
  • any time related functions will be working fine before human extinction

Package Sidebar

Install

npm i fast-unique-id

Weekly Downloads

5

Version

1.1.1

License

ISC

Unpacked Size

4.97 kB

Total Files

8

Last publish

Collaborators

  • scrwdrv