Skip to content

Commit

Permalink
fix(indent): indent on arrays of objects
Browse files Browse the repository at this point in the history
closes #159
  • Loading branch information
dockleryxk authored and kenany committed Dec 1, 2022
1 parent 5f2d89a commit 8c71aae
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ module.exports = function(hash, options = {}) {
function visit(hash, prefix) {
const nestedPairs = [];
const simplePairs = [];

let indentStr = '';
const indentStr = ''.padStart(options.indent, ' ');

Object.keys(hash).sort().forEach((key) => {
const value = hash[key];
Expand All @@ -78,7 +77,6 @@ module.exports = function(hash, options = {}) {
if (!isEmpty(prefix) && !isEmpty(simplePairs)
&& !isArrayOfTables(simplePairs)) {
toml += '[' + prefix + ']\n';
indentStr = ''.padStart(options.indent, ' ');
}

simplePairs.forEach((array) => {
Expand Down

0 comments on commit 8c71aae

Please sign in to comment.