function encodeUuid()

in src/common-amqp/amqp_message.ts [12:25]


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;
}