• Checks if a string is a valid hexadecimal string representation. If 'prefix' is 'true', the string must start with '0x' or '0X' followed by one or more hexadecimal digits (0-9, a-f, A-F), otherwise no prefix is expected. 'prefix' is optional and if its value it is not explicitly defined it will be set to 'true' by default.

    Parameters

    • value: any

      The string to be tested.

    • prefix: boolean = true

      A boolean to include or not a '0x' or '0X' prefix.

    Returns boolean