Function to stringify data correctly. Some data types like Error, Map, Set, etc. are not stringified correctly by JSON.stringify. This function handles those cases and avoids circular references.

  • Parameters

    • data: unknown

      The data to be stringified.

    Returns string

    The stringified data.