summaryrefslogtreecommitdiff
path: root/node_modules/gray-matter/lib/parse.js
blob: e10ea9beb4f4e1b48fd503def84c47448fa780c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
'use strict';

const getEngine = require('./engine');
const defaults = require('./defaults');

module.exports = function(language, str, options) {
  const opts = defaults(options);
  const engine = getEngine(language, opts);
  if (typeof engine.parse !== 'function') {
    throw new TypeError('expected "' + language + '.parse" to be a function');
  }
  return engine.parse(str, opts);
};