defaults.js (539B)
1 'use strict'; 2 3 const engines = require('./engines'); 4 const utils = require('./utils'); 5 6 module.exports = function(options) { 7 const opts = Object.assign({}, options); 8 9 // ensure that delimiters are an array 10 opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || '---'); 11 if (opts.delimiters.length === 1) { 12 opts.delimiters.push(opts.delimiters[0]); 13 } 14 15 opts.language = (opts.language || opts.lang || 'yaml').toLowerCase(); 16 opts.engines = Object.assign({}, engines, opts.parsers, opts.engines); 17 return opts; 18 };