code: function filenameExtensionFilter (ext) {
    if (typeof ext === 'string') {
      return (_, path) => path.endsWith('.' + ext);
    } else if (ext instanceof Array) {
      return ext
        .map(filenameExtensionFilter)
        .reduce(pcomp);
    }
  }
docs: return a predicate which matches files with the given extension(s);