l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

parse.js (389B)


      1 'use strict';
      2 
      3 const getEngine = require('./engine');
      4 const defaults = require('./defaults');
      5 
      6 module.exports = function(language, str, options) {
      7   const opts = defaults(options);
      8   const engine = getEngine(language, opts);
      9   if (typeof engine.parse !== 'function') {
     10     throw new TypeError('expected "' + language + '.parse" to be a function');
     11   }
     12   return engine.parse(str, opts);
     13 };