Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mohsen1/yawn-yaml
YAML parser that preserves comments and styling
https://github.com/mohsen1/yawn-yaml
Last synced: 16 days ago
JSON representation
YAML parser that preserves comments and styling
- Host: GitHub
- URL: https://github.com/mohsen1/yawn-yaml
- Owner: mohsen1
- License: mit
- Created: 2015-09-23T00:51:39.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-25T07:15:37.000Z (7 months ago)
- Last Synced: 2024-04-25T17:42:23.393Z (7 months ago)
- Language: TypeScript
- Homepage: https://azimi.me/yawn-yaml/demo/index.html
- Size: 1.85 MB
- Stars: 98
- Watchers: 4
- Forks: 25
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YAWN YAML 🥱
YAML parser that preserves comments and styling
**[Live Demo](http://azimi.me/yawn-yaml/demo/index.html)**
## Usage
```ts
import YAWN from 'yawn-yaml';let str = `
# my comment
value: 1 # the value is here!
`;let yawn = new YAWN(str);
// update the `json` property
yawn.json = { value: 2 };// value in `yawn.yaml` is now changed.
// with comments and styling preserved.
console.log(yawn.yaml); // =>
// # my comment
// value: 2 # the value is here!
```## Installation
Use npm or yarn to install [`yawn-yaml`](https://www.npmjs.com/package/yawn-yaml) package
```bash
npm install --save yawn-yaml
``````bash
yarn add yawn-yaml
```## Development
To install dependencies run:
```bash
yarn install
```To run tests continuously and watch for changes
```bash
yarn start
```To run the test run:
```bash
yarn test
```## License
[MIT](./LICENSE)