code: function getNewFilename(list, name) {
    if (list.indexOf(name) === -1) {
      return name;
    }
    const parsed = parseFilename(name);
    const base = parsed.base;
    const ext = parsed.ext;
    if (!base) {
      const newName = getNextNumberName(ext);
      return getNewFilename(list, newName);
    } else {
      const basename = getNextNumberName(base);
      return getNewFilename(list, `${basename}${ext}`);
    }
  }
docs: Generating a new filename to avoid names in the list by adding sequenced number
  @param {string[]} list - Filenames already in use
  @param {string} name - New filenames about to use
  @returns {string} - Generated new filename