Skip to content

Commit a98aa91

Browse files
committed
Adds style option for nested sequence
Each nested array will be in a new line if true - - 1 else - - 1
1 parent d6983dd commit a98aa91

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/js-yaml/dumper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ function State(options) {
118118
this.noRefs = options['noRefs'] || false;
119119
this.noCompatMode = options['noCompatMode'] || false;
120120
this.condenseFlow = options['condenseFlow'] || false;
121+
this.nestedSeqBlocks = options['nestedSeqBlocks'] || false;
121122

122123
this.implicitTypes = this.schema.compiledImplicit;
123124
this.explicitTypes = this.schema.compiledExplicit;
@@ -549,6 +550,10 @@ function writeBlockSequence(state, level, object, compact) {
549550
} else {
550551
_result += '- ';
551552
}
553+
554+
if(state.nestedSeqBlocks && Array.isArray(object[index])) {
555+
_result += generateNextLine(state, level+1);
556+
}
552557

553558
_result += state.dump;
554559
}

0 commit comments

Comments
 (0)