UNPKG

embed-support

Version:

Create embed codes for a static web project

29 lines (21 loc) 692 B
/* eslint-disable no-console */ const fileExists = require('file-exists'); const chalk = require('chalk'); // return true if there are no errors module.exports = function validateOptions(opts) { let errors = false; if (!opts.dest) { console.log(`${chalk.red('[Error]')} ${chalk.blue('dest')} is not defined`); errors = true; } if (opts.template && !fileExists(opts.template)) { console.log(`${chalk.red('[Error]')} template file ` + `${chalk.blue(opts.template)} does not exist`); errors = true; } if (!opts.iframeUrl) { console.log(`${chalk.red('[Error]')} ${chalk.blue('iframeUrl')} is not defined`); errors = true; } return !errors; };