Skip to main content

Class: Sequence

Defined in: sequence.d.ts:9

Represents a YAML sequence, which is an ordered collection of items. A sequence can contain mappings, other sequences, or scalars. It provides methods to add, set, insert, get, and manipulate its items.

Constructors

Constructor

new Sequence(): Sequence;

Defined in: sequence.d.ts:10

Returns

Sequence

Constructor

new Sequence(items): Sequence;

Defined in: sequence.d.ts:11

Parameters

ParameterType
itemsany[]

Returns

Sequence

Methods

add()

Call Signature

add(mapping): void;

Defined in: sequence.d.ts:14

Appends the given Mapping to the sequence.

Parameters
ParameterType
mappingObject | Mapping
Returns

void

Call Signature

add(mappings): void;

Defined in: sequence.d.ts:17

Appends the given Mapping array to the sequence.

Parameters
ParameterType
mappingsMapping[] | Object[]
Returns

void

Call Signature

add(sequence): void;

Defined in: sequence.d.ts:20

Appends the given Sequence to the sequence.

Parameters
ParameterType
sequenceany[] | Sequence
Returns

void

Call Signature

add(sequences): void;

Defined in: sequence.d.ts:23

Appends the given Sequence array to the sequence.

Parameters
ParameterType
sequencesany[] | Sequence[]
Returns

void

Call Signature

add(scalar): void;

Defined in: sequence.d.ts:26

Appends the given Scalar to the sequence.

Parameters
ParameterType
scalarScalar
Returns

void

Call Signature

add(scalars): void;

Defined in: sequence.d.ts:29

Appends the given Scalar array to the sequence.

Parameters
ParameterType
scalarsScalar[]
Returns

void

Call Signature

add(value): Scalar;

Defined in: sequence.d.ts:32

Appends the given value to the sequence as a Scalar and returns the created scalar.

Parameters
ParameterType
valuestring
Returns

Scalar

Call Signature

add(values): void;

Defined in: sequence.d.ts:35

Appends the given values to the sequence as Scalars.

Parameters
ParameterType
valuesstring[]
Returns

void


clear()

clear(): void;

Defined in: sequence.d.ts:89

Removes all elements.

Returns

void


clone()

clone(): Sequence;

Defined in: sequence.d.ts:92

Returns a deep clone of the sequence.

Returns

Sequence


getMapping()

Call Signature

getMapping(index): Mapping;

Defined in: sequence.d.ts:62

Returns the child at given index as Mapping. Throws if the child is not a Mapping.

Parameters
ParameterType
indexnumber
Returns

Mapping

Call Signature

getMapping(filter): Mapping;

Defined in: sequence.d.ts:65

Returns the first child that returns true for the filter function. Returns null if the node is not found.

Parameters
ParameterType
filter(mapping) => boolean
Returns

Mapping


getScalar()

Call Signature

getScalar(index): Scalar;

Defined in: sequence.d.ts:74

Returns the child at given index as Scalar. Throws if the child is not a Scalar.

Parameters
ParameterType
indexnumber
Returns

Scalar

Call Signature

getScalar(filter): Scalar;

Defined in: sequence.d.ts:77

Returns the first child that returns true for the filter function. Returns null if the node is not found.

Parameters
ParameterType
filter(scalar) => boolean
Returns

Scalar


getSequence()

Call Signature

getSequence(index): Sequence;

Defined in: sequence.d.ts:68

Returns the child at given index as Sequence. Throws if the child is not a Sequence.

Parameters
ParameterType
indexnumber
Returns

Sequence

Call Signature

getSequence(filter): Sequence;

Defined in: sequence.d.ts:71

Returns the first child that returns true for the filter function. Returns null if the node is not found.

Parameters
ParameterType
filter(sequence) => boolean
Returns

Sequence


getValue()

getValue(index): string;

Defined in: sequence.d.ts:80

Returns the value at given index. Throws if the child is not a Scalar.

Parameters

ParameterType
indexnumber

Returns

string


insert()

Call Signature

insert(index, mapping): void;

Defined in: sequence.d.ts:50

Inserts the given Mapping at given index.

Parameters
ParameterType
indexnumber
mappingMapping
Returns

void

Call Signature

insert(index, sequence): void;

Defined in: sequence.d.ts:53

Inserts the given Sequence at given index.

Parameters
ParameterType
indexnumber
sequenceSequence
Returns

void

Call Signature

insert(index, scalar): void;

Defined in: sequence.d.ts:56

Inserts the given Scalar at given index.

Parameters
ParameterType
indexnumber
scalarScalar
Returns

void

Call Signature

insert(index, value): Scalar;

Defined in: sequence.d.ts:59

Inserts the value as a Scalar at given index and returns the created scalar.

Parameters
ParameterType
indexnumber
valuestring
Returns

Scalar


length()

length(): number;

Defined in: sequence.d.ts:83

Returns the number of elements.

Returns

number


remove()

remove(index): void;

Defined in: sequence.d.ts:86

Removes the node at the given index.

Parameters

ParameterType
indexnumber

Returns

void


set()

Call Signature

set(index, mapping): void;

Defined in: sequence.d.ts:38

Sets the child at given index to the given Mapping.

Parameters
ParameterType
indexnumber
mappingMapping
Returns

void

Call Signature

set(index, sequence): void;

Defined in: sequence.d.ts:41

Sets the child at given index to the given Sequence.

Parameters
ParameterType
indexnumber
sequenceSequence
Returns

void

Call Signature

set(index, scalar): void;

Defined in: sequence.d.ts:44

Sets the child at given index to the given Scalar.

Parameters
ParameterType
indexnumber
scalarScalar
Returns

void

Call Signature

set(index, value): Scalar;

Defined in: sequence.d.ts:47

Sets the value at given index as a Scalar and returns the created scalar.

Parameters
ParameterType
indexnumber
valuestring
Returns

Scalar