How to use the minimatch function in minimatch

To help you get started, we’ve selected a few minimatch 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 kamilkisiela / graphql-config / src / utils.ts View on Github external
return (globs || []).some(glob => {
    try {
      const globStat = lstatSync(join(configDir, glob));
      const globToMatch = globStat.isDirectory() ? `${glob}/**` : glob;
      return minimatch(filePath, globToMatch, {matchBase: true});
    } catch (error) {
      // Out of errors that lstat provides, EACCES and ENOENT are the
      // most likely. For both cases, run the match with the raw glob
      // and return the result.
      return minimatch(filePath, glob, {matchBase: true});
    }
  });
}
github stellar / developers / gulp / sidecarMetadata.js View on Github external
_.each(allFiles, (f, p) => {
    if (!minimatch(p, '**/*.metadata')) {
      return;
    }

    delete f.contents;
    delete f.mode;
    delete f.stats;

    let mainPath = p.replace(/\.metadata$/, '');

    if (mainPath in allFiles) {
      allFiles[mainPath] = _.extend(allFiles[mainPath], f);
    }
    delete allFiles[p];
  });
github elastic / kibana / x-pack / legacy / plugins / upgrade_assistant / server / np_ready / lib / apm / index.ts View on Github external
const find = apmIndexPatterns.find(pattern => {
    return minimatch(indexName, pattern);
  });
github bali182 / autocomplete-json / src / utils.js View on Github external
function doMatches(pattern, file) {
  const path = pattern.indexOf('/') > -1 ? file.getRealPathSync() : file.getBaseName()
  const search = process.platform === 'win32' ? pattern.replace(/\//g, '\\') : pattern
  return minimatch(path, search)
}
github opencollective / backyourstack / src / lib / dependencies / index.js View on Github external
function detectDependencyFileType (file) {
  for (const type in dependencyManagers) {
    for (const matchedPattern of dependencyManagers[type].patterns) {
      if (minimatch(file.name, matchedPattern)) {
        return Object.assign(file, { type, matchedPattern });
      }
    }
  }
}
github jariz / gatsby-plugin-s3 / src / bin.ts View on Github external
const getParams = (path: string, params: Params): Partial => {
    let returned = {};
    for (const key of Object.keys(params)) {
        if (minimatch(path, key)) {
            returned = {
                ...returned,
                ...params[key],
            };
        }
    }

    return returned;
};
github stellar / developers / gulpfile.babel.js View on Github external
  let toReplace = _(files).keys().pickBy(key => minimatch(key, '*.handlebars')).value();
  _.each(toReplace, key => {
github connectivedx / fuzzy-chainsaw / source / static.jsx View on Github external
export const getModule = (path) => {
  const normalPath = normalizePath(path);

  if (match(normalPath, './styleguide/atoms/**')) {
    return getStyleguideModule(path, atomsContext, 'atoms');
  } else if (match(normalPath, './styleguide/molecules/**')) {
    return getStyleguideModule(path, moleculesContext, 'molecules');
  } else if (match(normalPath, './styleguide/organisms/**')) {
    return getStyleguideModule(path, organismsContext, 'organisms');
  } else if (match(normalPath, './styleguide/templates/**')) {
    return getStyleguideModule(path, templatesContext, 'templates');
  } else if (match(normalPath, './styleguide/modifiers/**')) {
    return getStyleguideModule(path, modifiersContext, 'modifiers');
  }

  const pagePath = `${normalPath}.jsx`;
  const pagePathList = pagesContext.keys();

  if (pagePathList.indexOf(pagePath) !== -1) {
    const module = pagesContext(pagePath).default;

    return Object.assign({ }, module, {