Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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});
}
});
}
_.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];
});
const find = apmIndexPatterns.find(pattern => {
return minimatch(indexName, pattern);
});
return patterns.some(pattern => minimatch(file, pattern));
};
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)
}
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 });
}
}
}
}
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;
};
let toReplace = _(files).keys().pickBy(key => minimatch(key, '*.handlebars')).value();
_.each(toReplace, key => {
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, {
const key = files.find(f => minimatch(filePath, f));
return instruction[key];