(u: unknown, whitespace: number | string | undefined = 2)
| 183 | * @since 2.0.0 |
| 184 | */ |
| 185 | export const toStringUnknown = (u: unknown, whitespace: number | string | undefined = 2): string => { |
| 186 | if (typeof u === "string") { |
| 187 | return u |
| 188 | } |
| 189 | try { |
| 190 | return typeof u === "object" ? formatJson(u, { space: whitespace }) : String(u) |
| 191 | } catch { |
| 192 | return String(u) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * A base prototype object that implements the {@link Inspectable} interface. |
no test coverage detected
searching dependent graphs…