Skip to main content
Version: 11.14.0

guid

Generates a pseudo-GUID string using Math.random.

Parameters

ParameterTypeRequiredDescription
withHyphensbooleanInclude hyphens in the output. Default: true

Returns string — a newly generated GUID.

Example

guid.ts
import { guid } from '@sinequa/atomic';

console.log(guid()); // '550e8400-e29b-41d4-a716-446655440000'
console.log(guid(false)); // '550e8400e29b41d4a716446655440000'