Binance Connector JS
    Preparing search index...

    Function normalizeStreamId

    • Normalizes a stream ID to ensure it is valid, generating a random ID if needed.

      For string inputs:

      • Returns the input if it's a valid 32-character hexadecimal string (case-insensitive)
      • Otherwise, generates a new random hexadecimal string using randomString()

      For number inputs:

      • Returns the input if it's a finite, non-negative integer within the safe integer range
      • Otherwise, generates a new random integer using randomInteger()

      For null or undefined inputs:

      • Generates a new random hexadecimal string using randomString()

      Parameters

      • id: undefined | null | string | number

        The stream ID to normalize (string, number, null, or undefined).

      • OptionalstreamIdIsStrictlyNumber: boolean

        Boolean forcing an id to be a number or not.

      Returns string | number

      A valid stream ID as either a 32-character hexadecimal string or a safe integer.