js-yaml-promise

1.0.0 • Public • Published

js-yaml-promise

Promise wrapper around 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:

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 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.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i js-yaml-promise

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • thejmazz