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

Function stringify

packages/effect/src/encoding/JsonArray.ts:704–715  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

702> => Channel.pipeTo(decode(options), ChannelSchema.decodeUnknown(schema)())
703
704const stringify = (value: unknown): string => {
705 let output: string | undefined
706 try {
707 output = JSON.stringify(value)
708 } catch (cause) {
709 throw new JsonArrayError({ kind: "Encode", message: cause instanceof Error ? cause.message : String(cause), cause })
710 }
711 if (output === undefined) {
712 throw new JsonArrayError({ kind: "Encode", message: `Value of type ${typeof value} cannot be represented as JSON` })
713 }
714 return output
715}
716
717/**
718 * Creates a channel that writes a stream of values as the text of one JSON

Callers

nothing calls this directly

Calls 1

StringFunction · 0.50

Tested by

no test coverage detected