Resource views
Self-explaining output for logs, docs, and tools.
Prefer the live demos? Open this section in the interactive docs.
An opt-in, self-explaining view of a value or result for logs, docs, debugging, and tool output — object names, grouped fields, source text on spans, and rich unit labels. describeResource() and describeResult() live in @pascal-app/lingo/describe.
import { lingo } from "@pascal-app/lingo"
import { describeResult } from "@pascal-app/lingo/describe"
describeResult(lingo("72 in to cm")).data
// {
// object: "lingo.conversion",
// source: { object: "lingo.quantity", value: { amount: 72, unit: { id: "in", ... } } },
// target: { unit: { id: "cm", name: "centimeter" } },
// converted: { object: "lingo.quantity", value: { amount: 182.88, unit: { id: "cm", ... } } },
// }
// Keep toJSON() for compact wire storage; describe* is the readable view.Resource views do not replace compact toJSON() wire storage — they are the human- and agent-readable counterpart.