Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thejmazz/js-yaml-promise
Promise wrapper around js-yaml
https://github.com/thejmazz/js-yaml-promise
Last synced: 19 days ago
JSON representation
Promise wrapper around js-yaml
- Host: GitHub
- URL: https://github.com/thejmazz/js-yaml-promise
- Owner: thejmazz
- License: mit
- Created: 2016-10-16T17:12:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-16T17:16:42.000Z (over 8 years ago)
- Last Synced: 2024-12-16T04:49:54.610Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/js-yaml-promise
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-yaml-promise
Promise wrapper around [js-yaml][js-yaml]. Assumes a Promise implementation is present.
```
npm install --save js-yaml-promise
```All methods are the exact same, just return a Promise around the `try/catch`, for example:
```javascript
const yaml = require('js-yaml')exports.safeLoad = (string, options) => new Promise((resolve, reject) => {
try {
resolve(yaml.safeLoad(string, options))
} catch (err) {
reject(err)
}
})
```I made this since [node-yaml][node-yaml] did not provide a Promise wrapper
around `safeLoad` and `safeDump`, it merely exposed `parse` as `load` from
js-yaml. As well I prefer wrappers to do exactly that - wrap - not add extra
methods.[js-yaml]: https://github.com/nodeca/js-yaml
[node-yaml]: https://github.com/octet-stream/node-yaml## License
[MIT](https://jmazz.mit-license.org/)