Skip to main content

guid

Generates a globally unique identifier (GUID).

parametertypedescription
withHypensbooleanOptional. If true, includes hyphens in the GUID. Default is true.

Returns string: A newly generated GUID.

Example

guid-with-hypens.js
  import { guid } from "@sinequa/atomic";

console.log(guid());
// Output: "550e8400-e29b-41d4-a716-446655440000" (example GUID)
guid-without-hyphens.js
import { guid } from "@sinequa/atomic";

console.log(guid(false));
// Output: "550e8400e29b41d4a716446655440000" (example GUID without hyphens)