lib/index.js
async function validateOptions(options) {
  // Check that input glob was passed
  if (!options.paths.length) {
    throw new ValidationError('No paths specified')
  }

  // Check that output path was passed
  if (!options.outputDir) {
    throw new ValidationError('Please specify an output directory with -o or --output')
  }

  // Check that the existance of output path
  if (!await fsAsync.exists(options.outputDir)) {
    throw new ValidationError('Output directory doesn\'t exist')
  }

  // Check that output path is a directory
  const outStat = await fsAsync.stat(options.outputDir)
  if (!outStat.isDirectory()) {
    throw new ValidationError('Output path must be a directory')
  }

  // Check existance of CSS template (If set)
  if (options.cssTemplate && !await fsAsync.exists(options.cssTemplate)) {
    throw new ValidationError('CSS template not found')
  }

  // Check existance of HTML template (If set)
  if (options.htmlTemplate && !await fsAsync.exists(options.htmlTemplate)) {
    throw new ValidationError('HTML template not found')
  }

  // Validate codepoints file if passed
  if (options.codepoints) {
    if (!await fsAsync.exists(options.codepoints)) {
      throw new ValidationError(`Cannot find json file @ ${options.codepoints}!`)
    }

    const codepointsStat = await fsAsync.stat(options.codepoints)
    if (!codepointsStat.isFile() || path.extname(options.codepoints) !== '.json') {
      throw new ValidationError([
        'Codepoints file must be JSON',
        `${options.codepoints} is not a valid file.`
      ].join(' '))
    }
  }
}
async function validateOptions(options) {
  // Check that input glob was passed
  if (!options.paths.length) {
    throw new ValidationError('No paths specified')
  }

  // Check that output path was passed
  if (!options.outputDir) {
    throw new ValidationError('Please specify an output directory with -o or --output')
  }

  // Check that the existance of output path
  if (!await fsAsync.exists(options.outputDir)) {
    throw new ValidationError('Output directory doesn\'t exist')
  }

  // Check that output path is a directory
  const outStat = await fsAsync.stat(options.outputDir)
  if (!outStat.isDirectory()) {
    throw new ValidationError('Output path must be a directory')
  }

  // Check existance of CSS template (If set)
  if (options.cssTemplate && !await fsAsync.exists(options.cssTemplate)) {
    throw new ValidationError('CSS template not found')
  }

  // Check existance of HTML template (If set)
  if (options.htmlTemplate && !await fsAsync.exists(options.htmlTemplate)) {
    throw new ValidationError('HTML template not found')
  }

  // Validate codepoints file if passed
  if (options.codepoints) {
    if (!await fsAsync.exists(options.codepoints)) {
      throw new ValidationError(`Cannot find json file @ ${options.codepoints}!`)
    }

    const codepointsStat = await fsAsync.stat(options.codepoints)
    if (!codepointsStat.isFile() || path.extname(options.codepoints) !== '.json') {
      throw new ValidationError([
        'Codepoints file must be JSON',
        `${options.codepoints} is not a valid file.`
      ].join(' '))
    }
  }
}
async function validateOptions ( options ) { // Check that input glob was passed if ( ! options . paths . length ) { throw new ValidationError ( 'No paths specified' ) } // Check that output path was passed if ( ! options . outputDir ) { throw new ValidationError ( 'Please specify an output directory with -o or --output' ) } // Check that the existance of output path if ( ! await fsAsync . exists ( options . outputDir ) ) { throw new ValidationError ( 'Output directory doesn\'t exist' ) } // Check that output path is a directory const outStat = await fsAsync . stat ( options . outputDir ) if ( ! outStat . isDirectory ( ) ) { throw new ValidationError ( 'Output path must be a directory' ) } // Check existance of CSS template (If set) if ( options . cssTemplate && ! await fsAsync . exists ( options . cssTemplate ) ) { throw new ValidationError ( 'CSS template not found' ) } // Check existance of HTML template (If set) if ( options . htmlTemplate && ! await fsAsync . exists ( options . htmlTemplate ) ) { throw new ValidationError ( 'HTML template not found' ) } // Validate codepoints file if passed if ( options . codepoints ) { if ( ! await fsAsync . exists ( options . codepoints ) ) { throw new ValidationError ( ` ${ options . codepoints } ` ) } const codepointsStat = await fsAsync . stat ( options . codepoints ) if ( ! codepointsStat . isFile ( ) || path . extname ( options . codepoints ) !== '.json' ) { throw new ValidationError ( [ 'Codepoints file must be JSON' , ` ${ options . codepoints } ` ] . join ( ' ' ) ) } } }
Asynchronously validate generation options, check existance of given files
and directories

@throws
@param  {Object} options
@return {void}
Asynchronously validate generation options check existance of given files and directories