How to use the micromatch.contains function in micromatch

To help you get started, we’ve selected a few micromatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yarnpkg / yarn / src / cli / commands / list.js View on Github external
export function filterTree(tree: Tree, filters: Array, pattern: string = ''): boolean {
  if (tree.children) {
    tree.children = tree.children.filter(child => filterTree(child, filters, pattern));
  }

  const notDim = tree.color !== 'dim';
  const hasChildren = tree.children == null ? false : tree.children.length > 0;
  const name = tree.name.slice(0, tree.name.lastIndexOf('@'));
  const found = micromatch.any(name, filters) || micromatch.contains(name, pattern);

  return notDim && (found || hasChildren);
}
github yarnpkg / yarn / src / package-request.js View on Github external
dep =>
          filterByNames.indexOf(normalizePattern(dep.pattern).name) >= 0 ||
          (flags && flags.pattern && micromatch.contains(normalizePattern(dep.pattern).name, flags.pattern)),
      );
github traveloka / javascript / packages / marlint / lib / eslint.js View on Github external
return !ignores.some(pattern => {
      return micromatch.contains(path, pattern);
    });
  });
github verbose / verb / lib / utils / glob.js View on Github external
function contains(fp, patterns) {
  var len = patterns.length;
  while (len--) {
    if (mm.contains(fp, patterns[len])) {
      return true;
    }
  }
  return false;
}
github lint-deps / lint-deps / lib / glob.js View on Github external
function contains(fp, patterns) {
  var len = patterns.length;
  while (len--) {
    if (mm.contains(fp, patterns[len])) {
      return true;
    }
  }
  return false;
}
github ph1p / vuepress-jsdoc / cmds / index.js View on Github external
            files = files.filter(f => !mm.contains(f, exclude));
github laggingreflex / mochista / watcher / index.js View on Github external
        testFiles = testFiles.filter(f => !deletedTestFiles.some(d => mm.contains(f, d)));
        log.verbose(`Removed testFiles: -${deletedTestFiles.length}=${testFiles.length}`);
github yarnpkg / yarn / src / cli / commands / cache.js View on Github external
const filterOut = ({registry, package: manifest, remote} = {}) => {
    if (flags.pattern && !micromatch.contains(manifest.name, flags.pattern)) {
      return false;
    }
    return true;
  };

micromatch

Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.

MIT
Latest version published 2 years ago

Package Health Score

87 / 100
Full package analysis