src/utils.js
async function validateDirPath (dirPath) {
  try {
    const stats = await fs.lstat(dirPath);
    if (!stats.isDirectory()) {
      throw userError([
        'Source path must be a directory',
        ''
      ]);
    }
  } catch (error) {
    if (error.code === 'ENOENT') {
      throw userError([
        'No files or directories found at ' + dirPath,
        ''
      ]);
    }

    throw error;
  }
}
async function validateDirPath (dirPath) {
  try {
    const stats = await fs.lstat(dirPath);
    if (!stats.isDirectory()) {
      throw userError([
        'Source path must be a directory',
        ''
      ]);
    }
  } catch (error) {
    if (error.code === 'ENOENT') {
      throw userError([
        'No files or directories found at ' + dirPath,
        ''
      ]);
    }

    throw error;
  }
}
async function validateDirPath ( dirPath ) { try { const stats = await fs . lstat ( dirPath ) ; if ( ! stats . isDirectory ( ) ) { throw userError ( [ 'Source path must be a directory' , '' ] ) ; } } catch ( error ) { if ( error . code === 'ENOENT' ) { throw userError ( [ 'No files or directories found at ' + dirPath , '' ] ) ; } throw error ; } }
Validates that the given path is a directory, throwing user errors
in other cases.

@param {string} dirPath Path to validate

@see userError()
@throws Error if validation fails
Validates that the given path is a directory throwing user errors in other cases .