Skip to content

Commit

Permalink
Adds style option for nested sequence
Browse files Browse the repository at this point in the history
Each nested array will be in a new line if true
-
  - 1

else
- - 1
  • Loading branch information
AlexHolly committed Nov 16, 2019
1 parent d6983dd commit 9e06b6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/js-yaml/dumper.js
Expand Up @@ -118,6 +118,7 @@ function State(options) {
this.noRefs = options['noRefs'] || false;
this.noCompatMode = options['noCompatMode'] || false;
this.condenseFlow = options['condenseFlow'] || false;
this.nestedSeqBlocks = options['nestedSeqBlocks'] || false;

this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit;
Expand Down Expand Up @@ -550,6 +551,10 @@ function writeBlockSequence(state, level, object, compact) {
_result += '- ';
}

if (state.nestedSeqBlocks && Array.isArray(object[index])) {
_result += generateNextLine(state, level + 1);
}

_result += state.dump;
}
}
Expand Down

0 comments on commit 9e06b6a

Please sign in to comment.