js-yaml-promise
v1.0.0
Published
Barebones Promise wrapper around js-yaml.
Downloads
28
Readme
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.