lunaisadev-website-old/node_modules/gray-matter/lib/defaults.js

19 lines
539 B
JavaScript

'use strict';
const engines = require('./engines');
const utils = require('./utils');
module.exports = function(options) {
const opts = Object.assign({}, options);
// ensure that delimiters are an array
opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || '---');
if (opts.delimiters.length === 1) {
opts.delimiters.push(opts.delimiters[0]);
}
opts.language = (opts.language || opts.lang || 'yaml').toLowerCase();
opts.engines = Object.assign({}, engines, opts.parsers, opts.engines);
return opts;
};