• Stringify an item, returning an empty string on error, null, or undefined.

    Type Parameters

    • T

    Parameters

    • value: T

      The value to be stringified.

    • Optionaloptions: SafeStringifyOptions

      Options to modify the output.

      • defaultValue

        A default value to return if the value to be stringified cannot be stringified.

      • indent

        A number indicating how many spaces to indent nested structures. When specified, values are stringified over multiple lines indented the specified amount for each scope of the object.

    Returns string

    The stringified value or the default value.

  • Stringify an item, returning an empty string on error, null, or undefined.

    Type Parameters

    • T

    Parameters

    • value: T

      The value to be stringified.

    • OptionaldefaultValue: string

      The default value to return if the value is null, undefined, or not stringifiable.

    Returns string

    The stringified value.