code: function getExistingExtensions(filePath) {
      const basename = path.basename(filePath, path.extname(filePath))
      try {
          return fs
              .readdirSync(path.dirname(filePath))
              .filter(
                  filename =>
                      path.basename(filename, path.extname(filename)) === basename
              )
              .map(filename => path.extname(filename))
      } catch (_error) {
          return []
      }
  }
docs: Get all file extensions of the files which have the same basename.
  @param {string} filePath The path to the original file to check.
  @returns {string[]} File extensions.