all files / lib/parse/ yaml.js

90.91% Statements 10/11
100% Branches 4/4
66.67% Functions 2/3
83.33% Lines 5/6
1 branch Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                  35×                    
/**
 * YAML operations, parse or stringify.
 */
import jsYaml from 'js-yaml';
 
/**
 * Parse a YAML string into an object.
 * @param {string} str String containing YAML information.
 * @return {Object} Parsed YAML object.
 */
export function parse(str) {
  return jsYaml.safeLoad(str);
}
 
/**
 * Stringify an object to a YAML string.
 * @param {Object} obj JavaScript object.
 * @return {string} YAML document.
 */
export function stringify(obj) {
  return jsYaml.safeDump(obj);
}