devsite/node_modules/gray-matter/lib/defaults.js

19 lines
539 B
JavaScript
Raw Normal View History

2024-07-08 01:49:38 +00:00
'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;
};