How to use micromatch.matcher:
GitHub: grownjs/mortero
286 287 288 289 290 291 292 293 294 295 296 297
if (entry.modified) return (mtime(key) - entry.modified) > 0; } function filters(any, filter) { filter = filter.filter(Boolean).map(x => (typeof x !== 'function' ? micromatch.matcher(x, { dot: true }) : x)); return filepath => { if (!filter.length) return false;
How to use micromatch.default:
212 213 214 215 216 217 218 219 220 221
); // highlight paths from the current test file if ( (config.testMatch && config.testMatch.length && _micromatch.default.some(filePath, config.testMatch)) || filePath === relativeTestPath ) { filePath = _chalk.default.reset.cyan(filePath); }
How to use micromatch.not:
GitHub: geolaxy/GeolaxyForVSCode
330 331 332 333 334 335 336 337 338 339
resolve(uris); } try { // Get uris not matching from micromatch matches = micromatch.not( Array.from(uris, uri => uri.fsPath), ignoreGlobs ); // Convert back to Uris and resolve
How to use micromatch.contains:
395 396 397 398 399 400 401 402 403 404
? filterByPatterns.map(pattern => normalizePattern(pattern).name) : []; depReqPatterns = depReqPatterns.filter( dep => filterByNames.indexOf(normalizePattern(dep.pattern).name) >= 0 || (flags && flags.pattern && micromatch.contains(normalizePattern(dep.pattern).name, flags.pattern)), ); } const deps = await Promise.all(
How to use micromatch.capture:
68 69 70 71 72 73 74 75 76
for (const [folderPattern, namingPattern] of Object.entries(rules)) { if (!micromatch.isMatch(path, folderPattern)) { continue; } else { const matchedPaths = micromatch.capture(folderPattern, path) || []; const folders = matchedPaths .filter(isNotEmpty) .reduce((s, p) => s.concat(getAllFolders(p)), []);
How to use micromatch.braces:
GitHub: PandaJ0001/marihaks
126 127 128 129 130 131 132 133 134 135
return collection.concat(expandBraceExpansion(pattern)); }, []); } exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; function expandBraceExpansion(pattern) { return micromatch.braces(pattern, { expand: true, nodupes: true }); }
How to use micromatch.scan:
GitHub: PandaJ0001/marihaks
133 134 135 136 137 138 139 140 141 142
nodupes: true }); } exports.expandBraceExpansion = expandBraceExpansion; function getPatternParts(pattern, options) { let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); /** * The scan method returns an empty array in some cases. * See micromatch/picomatch#58 for more details. */
How to use micromatch.makeRe:
173 174 175 176 177 178 179 180 181 182
The following example shows how to create a glob that matches a numeric folder name between `01` and `25`, with leading zeros. ```js const fill = require('fill-range'); const regex = micromatch.makeRe('foo/{01..25}/bar', { expandRange(a, b) { return `(${fill(a, b, { toRegex: true })})`; } });
144
0
0
See more examples
How to use micromatch.isMatch:
237 238 239 240 241 242 243 244 245 246 247 248
pathName.substring(0, pathName.length - 4) + ".json" : pathName ); var match = patterns.find(function(pattern) { return mm.isMatch(pathName, pattern) || mm.isMatch(normalized, pattern); }); return match && mappings[match]; }