Skip to content

Commit

Permalink
refactor: switch minimatch to micromatch
Browse files Browse the repository at this point in the history
  • Loading branch information
weyusi committed Jul 11, 2019
1 parent 5e5ccb0 commit 87e5554
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions lib/generator.js
@@ -1,6 +1,6 @@
'use strict';

const minimatch = require('minimatch');
const micromatch = require('micromatch');
const template = require('./template');

module.exports = function(locals) {
Expand Down Expand Up @@ -36,13 +36,5 @@ module.exports = function(locals) {
};

function isMatch(path, patterns) {
if (!patterns) return false;
if (!Array.isArray(patterns)) patterns = [patterns];
if (!patterns.length) return false;

for (let i = 0, len = patterns.length; i < len; i++) {
if (minimatch(path, patterns[i])) return true;
}

return false;
return micromatch.isMatch(path, patterns);
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -29,7 +29,7 @@
],
"license": "MIT",
"dependencies": {
"minimatch": "^3.0.0",
"micromatch": "^4.0.2",
"nunjucks": "^3.1.6"
},
"devDependencies": {
Expand Down

0 comments on commit 87e5554

Please sign in to comment.