Yaml Edit | Coderz Product

yaml_edit

Last updated:

0 purchases

yaml_edit Image
yaml_edit Images

Free

Languages

Categories

Add to Cart

Description:

yaml edit

A library for YAML manipulation while preserving comments.
Usage #
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}
}
copied to clipboard
Example: Converting JSON to YAML (block formatted) #
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());
}
copied to clipboard
Testing #
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.
Limitations #

Users are not allowed to define tags in the modifications.
Map keys will always be added in the flow style.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.