ChemPal Documentation - v1.17.0
    Preparing search index...

    Function isTraceId

    • Whether a value is a well-formed trace id, so a malformed one is never sent as the trace_id.

      Parameters

      • value: unknown

        The value to test

      Returns value is string

      true for 32 lowercase hex characters that are not all zero

      isTraceId('4bf92f3577b34da6a3ce929d0e0e4736'); // true
      isTraceId('00000000000000000000000000000000'); // false
      isTraceId('not-a-trace-id'); // false
      export function isTraceId(value: unknown): value is string {
      return typeof value === 'string' && TRACE_ID_PATTERN.test(value);
      }