Function formatAsString

Formats an object as a string. It supports more meaningful formatting as string for certain types rather than using the default string representation.

NOTE: This is not intended for serialization of data that needs to be de-serialized. Only for debugging output.

  • Parameters

    • value: unknown

      The value to format as string.

    • OptionalmaxLen: number

      Maximum length of the returned string. If not given or is <= 0, the string is not truncated. Otherwise, if the result is longer than maxLen, it is truncated to maxLen - 3 and added a suffix of "...". Note that if maxLen is > 0 but <= 3, the result is always "..."

    Returns string