From 87e555419854d39c32931c0e7f6f9247bf3ad4e2 Mon Sep 17 00:00:00 2001 From: weyusi Date: Thu, 11 Jul 2019 15:36:43 +0930 Subject: [PATCH] refactor: switch minimatch to micromatch --- lib/generator.js | 12 ++---------- package.json | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/generator.js b/lib/generator.js index 0a6d763..1cea34f 100644 --- a/lib/generator.js +++ b/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) { @@ -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); } diff --git a/package.json b/package.json index e443f1b..92ec42f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ ], "license": "MIT", "dependencies": { - "minimatch": "^3.0.0", + "micromatch": "^4.0.2", "nunjucks": "^3.1.6" }, "devDependencies": {