Skip to main content

Class: Scalar

Defined in: scalar.d.ts:42

Represents a YAML scalar value. A scalar has a string value and an optional style.

Constructors

Constructor

new Scalar(value?, style?): Scalar;

Defined in: scalar.d.ts:50

Creates a scalar with the given value and style. If no value is provided, it defaults to an empty string. If no style is provided, it defaults to plain style.

Parameters

ParameterTypeDescription
value?string | number | booleanThe scalar value (string, number, or boolean).
style?YamlStyleThe style of the scalar (YamlStyle).

Returns

Scalar

Methods

clone()

clone(): Scalar;

Defined in: scalar.d.ts:62

Returns a deep clone of the scalar.

Returns

Scalar


getValue()

getValue(): string;

Defined in: scalar.d.ts:53

Returns the value of the scalar.

Returns

string


setStyle()

setStyle(style): void;

Defined in: scalar.d.ts:59

Sets the style of the scalar.

Parameters

ParameterType
styleYamlStyle

Returns

void


setValue()

setValue(value): void;

Defined in: scalar.d.ts:56

Sets the value of the scalar.

Parameters

ParameterType
valuestring | number | boolean

Returns

void