(u: unknown, whitespace: number | string | undefined = 2)
| 191 | * @since 2.0.0 |
| 192 | */ |
| 193 | export const toStringUnknown = (u: unknown, whitespace: number | string | undefined = 2): string => { |
| 194 | if (typeof u === "string") { |
| 195 | return u |
| 196 | } |
| 197 | try { |
| 198 | return typeof u === "object" ? formatJson(u, { space: whitespace }) : format(u, { space: whitespace }) |
| 199 | } catch { |
| 200 | return String(u) |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * A base prototype object that implements the {@link Inspectable} interface. |
no test coverage detected