Skip to content

Commit

Permalink
feat: multiline nested arrays in dump() output
Browse files Browse the repository at this point in the history
  • Loading branch information
zajrik committed Jul 8, 2021
1 parent 88a0f44 commit 3ac2940
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.0

- Update `dump()` to multi-line nested arrays. This will better visually represent 2-dimensional arrays.

## 1.1.1

- Update readme
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ String _stringify(dynamic value)

if (value is List)
{
final bool shouldMultiline = value.any((element) => element is Map);
final bool shouldMultiline = value.any((element) => element is Map || element is List);

if (!shouldMultiline)
return '[${value.map((e) => _stringify(e)).join(', ')}]';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: gura
description: A simple to use library for reading/writing Gura configuration files.
version: 1.1.1
version: 1.2.0
homepage: https://gura.netlify.app/
repository: https://github.com/zajrik/gura-dart-parser
issue_tracker: https://github.com/zajrik/gura-dart-parser/issues
Expand Down
36 changes: 26 additions & 10 deletions test/dump_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ void main()
[{ 'baz': 'boo', 'far': 'faz' }]
]
},
{
'bar': [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
},
]
};

Expand All @@ -45,16 +52,25 @@ foo: [
bar:
baz: "boo"
far: "faz",
bar: [[
baz: "boo"
far: "faz"
], [
baz: "boo"
far: "faz"
], [
baz: "boo"
far: "faz"
]]
bar: [
[
baz: "boo"
far: "faz"
],
[
baz: "boo"
far: "faz"
],
[
baz: "boo"
far: "faz"
]
],
bar: [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
]
''';

Expand Down

0 comments on commit 3ac2940

Please sign in to comment.