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
Parameter | Type |
---|---|
items | any [] |
Returns
Sequence
Methods
add()
Call Signature
add(mapping): void;
Defined in: sequence.d.ts:14
Appends the given Mapping to the sequence.
Parameters
Parameter | Type |
---|---|
mapping | Object | Mapping |
Returns
void
Call Signature
add(mappings): void;
Defined in: sequence.d.ts:17
Appends the given Mapping array to the sequence.
Parameters
Parameter | Type |
---|---|
mappings | Mapping [] | Object [] |
Returns
void
Call Signature
add(sequence): void;
Defined in: sequence.d.ts:20
Appends the given Sequence to the sequence.
Parameters
Parameter | Type |
---|---|
sequence | any [] | Sequence |
Returns
void
Call Signature
add(sequences): void;
Defined in: sequence.d.ts:23
Appends the given Sequence array to the sequence.
Parameters
Parameter | Type |
---|---|
sequences | any [] | Sequence [] |
Returns
void
Call Signature
add(scalar): void;
Defined in: sequence.d.ts:26
Appends the given Scalar to the sequence.
Parameters
Parameter | Type |
---|---|
scalar | Scalar |
Returns
void
Call Signature
add(scalars): void;
Defined in: sequence.d.ts:29
Appends the given Scalar array to the sequence.
Parameters
Parameter | Type |
---|---|
scalars | Scalar [] |
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
Parameter | Type |
---|---|
value | string |
Returns
Call Signature
add(values): void;
Defined in: sequence.d.ts:35
Appends the given values to the sequence as Scalars.
Parameters
Parameter | Type |
---|---|
values | string [] |
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
Parameter | Type |
---|---|
index | number |
Returns
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
Parameter | Type |
---|---|
filter | (mapping ) => boolean |
Returns
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
Parameter | Type |
---|---|
index | number |
Returns
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
Parameter | Type |
---|---|
filter | (scalar ) => boolean |
Returns
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
Parameter | Type |
---|---|
index | number |
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
index | number |
Returns
string
insert()
Call Signature
insert(index, mapping): void;
Defined in: sequence.d.ts:50
Inserts the given Mapping at given index.
Parameters
Parameter | Type |
---|---|
index | number |
mapping | Mapping |
Returns
void
Call Signature
insert(index, sequence): void;
Defined in: sequence.d.ts:53
Inserts the given Sequence at given index.
Parameters
Parameter | Type |
---|---|
index | number |
sequence | Sequence |
Returns
void
Call Signature
insert(index, scalar): void;
Defined in: sequence.d.ts:56
Inserts the given Scalar at given index.
Parameters
Parameter | Type |
---|---|
index | number |
scalar | Scalar |
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
Parameter | Type |
---|---|
index | number |
value | string |
Returns
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
Parameter | Type |
---|---|
index | number |
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
Parameter | Type |
---|---|
index | number |
mapping | Mapping |
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
Parameter | Type |
---|---|
index | number |
sequence | Sequence |
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
Parameter | Type |
---|---|
index | number |
scalar | Scalar |
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
Parameter | Type |
---|---|
index | number |
value | string |