serializers/yaml
Canonical YAML <-> NogginDocument conversion. This is the flavour every provider writes to disk / storage; hosts occasionally use these directly when they need to work with document bytes without opening a live Noggin.
toYaml()
function toYaml(doc: NogginDocument): string;
Serialize a NogginDocument to YAML. The resulting bytes round-trip cleanly back through fromYaml.
Parameters
| Parameter | Type |
|---|---|
doc | NogginDocument |
Returns
string
fromYaml()
function fromYaml(text: string): NogginDocument;
Parse a YAML noggin document. Throws NogginError with code 'invalid-document' for structural failures or 'unsupported-schema' when the document declares a schema version this build doesn't speak.
Empty/whitespace input is treated as a fresh empty document.
Parameters
| Parameter | Type |
|---|---|
text | string |