commit | d15b44cb082fd4f0f25d15b25803228f7f0a316a | [log] [tgz] |
---|---|---|
author | Jonas Finnemann Jensen <jonasfj@google.com> | Mon May 06 15:05:54 2024 +0200 |
committer | GitHub <noreply@github.com> | Mon May 06 15:05:54 2024 +0200 |
tree | 780be7b922c613f611588555fef83f64ac93ea82 | |
parent | fe2699dd8757d052541c9dd5954aea60987cfbf2 [diff] |
Consume until end of document if there is no newline when removing from (#76) block map. Fixes #55.
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
.