Options
All
  • Public
  • Public/Protected
  • All
Menu

Vis UUID

UUID (version 1 and 4) generation library. Also offers conversion methods between string representation and binary (array of numbers or Uint8Array) representation. Comes in UMD version for good compatibility and ESM version ready for treeshaking.

This module is a part of the visjs project.

Documentation

https://visjs.github.io/vis-uuid/

Building the project

Clone the project:

git clone https://github.com/visjs/vis-uuid.git

Install dependencies:

npm i

Build the project (builds types, code and docs):

npm run build

Building individual parts

  • Code: npm run build:code
  • Docs: npm run build:docs
  • Types: npm run build:types

Other scripts

  • Clean built files: npm run clean
  • Lint: npm run lint
  • Reformat: npm run fix
  • Test: npm run build
  • Type check: npm run type-check

License

This project is dual licensed under

The Apache 2.0 License http://www.apache.org/licenses/LICENSE-2.0

and

The MIT License http://opensource.org/licenses/MIT

Vis UUID may be distributed under either license.

Original sources

Index

Type aliases

Bytes

Bytes: Uint8Array | number[]

Uint8Array or an array of numbers. Used to store binary UUIDs or to supply random data to generate them.

OldAPI

OldAPI: uuid4 & OldAPIProps

API as used before ES2015 modules and TypeScript.

Functions

parseUUID

  • parseUUID(str: string, buf?: Bytes, offset?: undefined | number): Bytes
  • Parse a string UUID representation into it's component bytes.

    Parameters

    • str: string

      String UUID.

    • Default value buf: Bytes = []

      Buffer to be filled with the bytes.

    • Optional offset: undefined | number

      Offset from the start of the buffer where the UUID bytes will be saved.

    Returns Bytes

    An array (or Uint8Array if supplied) of bytes.

stringifyUUID

  • stringifyUUID(buf: Bytes, offset?: undefined | number): string
  • Represent binary UUID into it's string representation.

    Parameters

    • buf: Bytes

      Buffer containing UUID bytes.

    • Optional offset: undefined | number

      Offset from the start of the buffer where the UUID is saved (not needed if the buffer starts with the UUID).

    Returns string

    String representation of the UUID.

uuid1

  • Generate UUIDv1

    Parameters

    • Optional options: UUID1Options

      Options to be used instead of default values.

    Returns string

    UUIDv1

  • Generate UUIDv1

    Parameters

    • options: UUID1Options

      Options to be used instead of default values.

    • buf: Bytes

      If present the buffer will be filled with the generated UUID.

    • Optional offset: undefined | number

      Offset of the UUID from the start of the buffer.

    Returns Bytes

    UUIDv1

uuid4

  • Generate UUIDv4

    Parameters

    • options: "binary"

      Options to be used instead of default generated values. String 'binary' is a shorthand for uuid4({}, new Array(16)).

    Returns number[]

    UUIDv4

  • Generate UUIDv4

    Parameters

    • Optional options: UUID4Options

      Options to be used instead of default generated values. String 'binary' is a shorthand for uuid4({}, new Array(16)).

    Returns string

    UUIDv4

  • Generate UUIDv4

    Parameters

    • options: "binary" | UUID4Options

      Options to be used instead of default generated values. String 'binary' is a shorthand for uuid4({}, new Array(16)).

    • buf: Bytes

      If present the buffer will be filled with the generated UUID.

    • Optional offset: undefined | number

      Offset of the UUID from the start of the buffer.

    Returns Bytes

    UUIDv4

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc