Skip to content

Commit 9e06b6a

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 9e06b6a

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;
@@ -550,6 +551,10 @@ function writeBlockSequence(state, level, object, compact) {
550551
_result += '- ';
551552
}
552553

554+
if (state.nestedSeqBlocks && Array.isArray(object[index])) {
555+
_result += generateNextLine(state, level + 1);
556+
}
557+
553558
_result += state.dump;
554559
}
555560
}

0 commit comments

Comments
 (0)