Skip to content

Function: uniqueId()

ts
function uniqueId(prefix?: string): string;

Defined in: src/utils/uniqueId.ts:18

Generate a unique ID with an optional prefix.

Parameters

ParameterTypeDefault valueDescription
prefixstring'$MW$'The prefix for the ID. Defaults to '$MW$'.

Returns

string

The generated unique ID string.

Example

ts
const id = uniqueId();
// "$MW$-a1b2c3d4-e5f6-7890-abcd-ef1234567890"

const customId = uniqueId('order');
// "order-a1b2c3d4-e5f6-7890-abcd-ef1234567890"

Matterway Assistant SDK Documentation