MCPcopy Create free account
hub / github.com/Effect-TS/effect / safeToString

Function safeToString

packages/effect/src/Formatter.ts:219–226  ·  view source on GitHub ↗
(input: any)

Source from the content-addressed store, hash-verified

217}
218
219function safeToString(input: any): string {
220 try {
221 const s = input.toString()
222 return typeof s === "string" ? s : String(s)
223 } catch {
224 return "[toString threw]"
225 }
226}
227
228/**
229 * Stringifies a value to JSON safely, silently dropping circular references.

Callers 1

recurFunction · 0.85

Calls 2

StringInterface · 0.70
toStringMethod · 0.65

Tested by

no test coverage detected