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

19 lines
539 B
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +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;
};