https://github.com/scrwdrv/fast-unique-id
non-standard universal unique id generation
https://github.com/scrwdrv/fast-unique-id
collision fast guid id javascript nodejs timestamp typescript unique uuid
Last synced: about 2 months ago
JSON representation
non-standard universal unique id generation
- Host: GitHub
- URL: https://github.com/scrwdrv/fast-unique-id
- Owner: scrwdrv
- License: mit
- Created: 2019-12-22T10:26:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-20T04:28:47.000Z (over 5 years ago)
- Last Synced: 2024-10-13T07:47:13.019Z (7 months ago)
- Topics: collision, fast, guid, id, javascript, nodejs, timestamp, typescript, unique, uuid
- Language: JavaScript
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```sh
npm i fast-unique-id
```## Usage
```js
import * as uniqueID from 'fast-unique-id';console.log(uniqueID.fast());
//68kUVYfj05caqmg0PLconsole.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