Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
class Nuid
import { Nuid } from "https://deno.land/x/natsws@v1.28.0/src/nats-base-client.ts";

Create and initialize a nuid.

Constructors

new
Nuid()

Properties

buf: Uint8Array
inc: number
inited: boolean
seq: number

Methods

private
fillSeq()

Fills the sequence part of the nuid as base36 from this.seq.

private
init()

Initializes a nuid with a crypto random prefix, and pseudo-random sequence and increment.

private
initSeqAndInc()

Initializes the pseudo randmon sequence number and the increment range.

private
setPre()

Sets the prefix from crypto random bytes. Converts to base36.

next(): string

Returns the next nuid.