inspector/codec#

Interfaces#

Codec#

Defined in: editor/src/inspector/codec.ts:35

Writing and reading one format, and finding a place in its text.

Methods#

locate()#

locate(text, path): Lines | null

Defined in: editor/src/inspector/codec.ts:39

The lines of text holding the value at path; null where it holds none.

Parameters#
text#

string

path#

readonly PathSegment[]

Returns#

Lines | null

read()#

read(text): Result<Read>

Defined in: editor/src/inspector/codec.ts:37

Parameters#
text#

string

Returns#

Result<Read>

write()#

write(value): Result<Text>

Defined in: editor/src/inspector/codec.ts:36

Parameters#
value#

Json

Returns#

Result<Text>


Read#

Defined in: editor/src/inspector/codec.ts:29

What reading a text gives: the manifest value and the document.

Properties#

source#

readonly source: Source

Defined in: editor/src/inspector/codec.ts:31

value#

readonly value: Json

Defined in: editor/src/inspector/codec.ts:30


Source#

Defined in: editor/src/inspector/codec.ts:17

The parsed document behind a text. patch changes the document to hold value, keeping everything of the text that value does not change, and returns the new text.

Properties#

format#

readonly format: "yaml" | "json" | "toml"

Defined in: editor/src/inspector/codec.ts:18

Methods#

patch()#

patch(value): Result<string>

Defined in: editor/src/inspector/codec.ts:19

Parameters#
value#

Json

Returns#

Result<string>


Text#

Defined in: editor/src/inspector/codec.ts:23

A text and the document it was written from or read into.

Properties#

source#

readonly source: Source

Defined in: editor/src/inspector/codec.ts:25

text#

readonly text: string

Defined in: editor/src/inspector/codec.ts:24

Type Aliases#

Format#

Format = typeof FORMATS[number]

Defined in: editor/src/inspector/codec.ts:10

One of the formats: yaml, json or toml.

Variables#

FORMATS#

const FORMATS: readonly ["yaml", "json", "toml"]

Defined in: editor/src/inspector/codec.ts:8

The formats in the order the format switches list them: YAML, the main serialization, first.