function processDirectory(config, dir, files, output) {
  // take only *.svg files, recursively if necessary
  const svgFilesDescriptions = getFilesDescriptions(config, dir, files, output);

  return svgFilesDescriptions.length
    ? Promise.all(
        svgFilesDescriptions.map((fileDescription) =>
          optimizeFile(
            config,
            fileDescription.inputPath,
            fileDescription.outputPath,
          ),
        ),
      )
    : Promise.reject(
        new Error(`No SVG files have been found in '${dir}' directory.`),
      );
}
Process given files, take only SVG.

@param {any} config options
@param {string} dir input directory
@param {ReadonlyArray<string>} files list of file names in the directory
@param {string} output output directory
@return {Promise<any>}