commit | 0668eb5bb20aceed557f783022ec5665e41fa2cc | [log] [tgz] |
---|---|---|
author | Jonas Finnemann Jensen <jonasfj@google.com> | Thu Mar 02 12:40:16 2023 +0100 |
committer | GitHub <noreply@github.com> | Thu Mar 02 12:40:16 2023 +0100 |
tree | 7e2cb733a9b6c55310c18a420c921cb0a9d2786d | |
parent | a4ff857eba2b84f7febd76b20e0206ea19cbcc97 [diff] |
Wrap recursively, prepare release (#28) * Wrap recursively, prepare release * Fix lints * Fix review comments
A library for YAML manipulation while preserving comments.
A simple usage example:
import 'package:yaml_edit/yaml_edit.dart'; void main() { final yamlEditor = YamlEditor('{YAML: YAML}'); yamlEditor.update(['YAML'], "YAML Ain't Markup Language"); print(yamlEditor); // Expected output: // {YAML: YAML Ain't Markup Language} }
void main() { final jsonString = r''' { "key": "value", "list": [ "first", "second", "last entry in the list" ], "map": { "multiline": "this is a fairly long string with\nline breaks..." } } '''; final jsonValue = json.decode(jsonString); // Convert jsonValue to YAML final yamlEditor = YamlEditor(''); yamlEditor.update([], jsonValue); print(yamlEditor.toString()); }
Testing is done in two strategies: Unit testing (/test/editor_test.dart
) and Golden testing (/test/golden_test.dart
). More information on Golden testing and the input/output format can be found at /test/testdata/README.md
.
These tests are automatically run with pub run test
.