How to use the rhea.string_to_uuid function in rhea

To help you get started, we’ve selected a few rhea examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-node / common / transport / amqp / src / amqp_message.ts View on Github external
function encodeUuid(uuidString: string): any {
  const uuidRegEx = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
  let uuid;
  if (typeof uuidString === 'string' && uuidString.match(uuidRegEx)) {
    //
    // The rhea library will only serialize the the uuid with an encoding of 0x98 if the uuid property is actually
    // a 16 byte buffer.
    //
    uuid = rheaStringToUuid(uuidString);
  } else {
    uuid = uuidString;
  }
  return uuid;
}