jsyaml

package
v6.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jsyaml writes YAML and JSON exactly as the TypeScript CLI did with js-yaml's dump and JSON.stringify. Users keep the files `get` writes in Git; any difference in formatting would show up as a change to every one of them after upgrading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(value any) any

Clone copies a value deeply, so that one copy can be trimmed for a request while the other is written back to its file intact.

func CompactJSON

func CompactJSON(value any) string

CompactJSON renders like JSON.stringify(value).

func Dump

func Dump(value any) string

Dump renders a value as js-yaml's dump did, trailing newline included.

func JSON

func JSON(value any) string

JSON renders like JSON.stringify(value, undefined, 2).

func NumberString

func NumberString(f float64) string

NumberString formats a float64 as JavaScript's Number.prototype.toString does.

Types

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map is a JavaScript object: string keys in JavaScript's iteration order.

func NewMap

func NewMap() *Map

func (*Map) Delete

func (m *Map) Delete(key string)

func (*Map) Get

func (m *Map) Get(key string) (any, bool)

func (*Map) Keys

func (m *Map) Keys() []string

Keys in JavaScript's order: keys that are array indices first, ascending, then the rest in insertion order. JSON.parse and js-yaml both see objects this way.

func (*Map) Len

func (m *Map) Len() int

func (*Map) Set

func (m *Map) Set(key string, value any)

Set keeps a key's first position when it is set again, as assigning to a JavaScript object property does.

func (*Map) SetFirst

func (m *Map) SetFirst(key string, value any)

SetFirst puts a key at the start, as the spread `{ key, ...experiment }` did.

type Timestamp

type Timestamp time.Time

Timestamp is a YAML timestamp read from a file, a JavaScript Date in the TypeScript CLI.

func (Timestamp) ISO

func (t Timestamp) ISO() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL