Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/web_bson/src/uuid.ts>UUID

web_bson is a fork from mongodb/js-bson
Very Popular
Go to Latest
class UUID
import { UUID } from "https://deno.land/x/web_bson@v0.2.5/src/uuid.ts";

A class representation of the BSON UUID type.

Constructors

new
UUID(input?: string | Uint8Array | UUID)

Create an UUID type

Properties

_bsontype: string
id: Uint8Array

The UUID bytes

Methods

equals(otherId: string | Uint8Array | UUID): boolean

Compares the equality of this UUID with otherID.

Creates a Binary instance from the current UUID.

toHexString(includeDashes?): string

Returns the UUID id as a 32 or 36 character hex string representation, excluding/including dashes (defaults to 36 character dash separated)

toJSON(): string

Converts the id into its JSON string representation. A 36 character (dashes included) hex string in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

toString(): string

same as to toHexString method

Static Properties

cacheHexString: boolean

Static Methods

createFromHexString(hexString: string): UUID

Creates an UUID from a hex string representation of an UUID.

generate(): Uint8Array

Generates a populated buffer containing a v4 uuid

isValid(input: string | Uint8Array | UUID): boolean

Checks if a value is a valid bson UUID