MCPcopy Create free account
hub / github.com/effect-app/libs / toStringUnknown

Function toStringUnknown

repos/effect/packages/effect/src/Inspectable.ts:185–194  ·  view source on GitHub ↗
(u: unknown, whitespace: number | string | undefined = 2)

Source from the content-addressed store, hash-verified

183 * @since 2.0.0
184 */
185export 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.

Callers 1

effect.tsFile · 0.90

Calls 2

formatJsonFunction · 0.90
StringInterface · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…