function getFilesDescriptions(config, dir, files, output) {
  const filesInThisFolder = files
    .filter(
      (name) =>
        name.slice(-4).toLowerCase() === '.svg' &&
        !config.exclude.some((/** @type {RegExp} */ regExclude) =>
          regExclude.test(name),
        ),
    )
    .map((name) => ({
      inputPath: path.resolve(dir, name),
      outputPath: path.resolve(output, name),
    }));

  if (!config.recursive) {
    return filesInThisFolder;
  }

  return filesInThisFolder.concat(
    files
      .filter((name) => checkIsDir(path.resolve(dir, name)))
      .map((subFolderName) => {
        const subFolderPath = path.resolve(dir, subFolderName);
        const subFolderFiles = fs.readdirSync(subFolderPath);
        const subFolderOutput = path.resolve(output, subFolderName);
        return getFilesDescriptions(
          config,
          subFolderPath,
          subFolderFiles,
          subFolderOutput,
        );
      })
      .reduce((a, b) => a.concat(b), []),
  );
}
Get SVG files descriptions.

@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 {any[]}