const previewDoc = require('./doc')

async function preview(type) {
  const previewHandler = {
    doc: previewDoc, // 处理文档生成
  }
  if (Object.prototype.hasOwnProperty.call(previewHandler, type)) {
    await previewHandler[type]()
  }
}

function execPreview(options) {
  Object.keys(options).forEach(async (type) => {
    await preview(type)
  })
}

module.exports = execPreview
