@nextform/serious
v1.0.0
Published
ID Generator
Maintainers
Readme
Serious
Serious IDs are numeric rather than string-based. They can be used in contexts where numeric IDs are required, such as database primary keys. They are under 53 bits of entropy, which is the maximum safe integer size in JavaScript and work well as 64-bit integers in databases.
Serious IDs can be generated safely though the year 2255. They are sortable and monotonic, so they can be used as primary keys in distributed databases without risk of collisions or duplicates, even if multiple IDs are generated in the same millisecond, assuming only one instance of Serious is generating IDs.
Install
npm i @nextform/seriousUsage
Import the Serious class and use the generate() method.
import { Serious } from '@nextform/serious'
Serious.generate() // => 1776801003243546