UNPKG

yapm

Version:

package manager for io.js (npm fork)

32 lines (23 loc) 1.61 kB
name: yaml-update version: 0.1.2 author: name: Alex Kocharin description: Update yaml file preserving structure (comments, linebreaks, etc.), VERY limited main: index.js directories: test: tests repository: type: git url: https://github.com/rlidwka/yaml-update dependencies: js-yaml: '>= 2' bugs: # a lot of them probably :P url: http://github.com/rlidwka/yaml-update/issues keywords: - yaml - update license: BSD readme: "\nThis module tries to update an existing yaml data preserving its structure (comments, linebreaks, etc.).\n\nIt's very hard to reliably update a part of yaml document. But it doesn't mean we shouldn't try.\n\n## Usage\n\n```javascript\nvar edit = require('yaml-update').edit;\n\n// result will be something like \"# comment\\ntest1: 123\\n\\ntest2: 456\\n\"\nedit(\"# comment\\ntest1: 123\\n\\ntest2: 123\\n\", {test1: 123, test2: 456});\n```\n\n## Limitations\n\nCurrently it changes only top-level objects. If you try to change something deep inside the document (like key1.key2.key3.something = 123), this module will rewrite key1 with all comments and data inside with the new data.\n\nTo ensure that it didn't change anything unintended, it compares resulting yaml data with the intended data and throws if it don't match.\n\n## Disclaimer\n\nThis module is written to solve one very specific task. It is not guaranteed to work everywhere.\n\nIt's very hard to reliably update a part of yaml document. If you know a good existing solution to do that please let me know.\n\n" readmeFilename: README.md _id: "yaml-update@0.1.2" _from: "yaml-update@*"