UNPKG

822 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const Path = require("path");
4const minimatch_1 = require("minimatch");
5const unix = Path.sep === '/';
6function normalize(pattern) {
7 if (pattern.startsWith('!') || pattern.startsWith('#')) {
8 return pattern[0] + normalize(pattern.substr(1));
9 }
10 if (unix) {
11 pattern = pattern.replace(/[\\]/g, '/').replace(/^\w:/, '');
12 }
13 if (pattern.substr(0, 2) !== '**') {
14 pattern = Path.resolve(pattern);
15 }
16 if (!unix) {
17 pattern = pattern.replace(/[\\]/g, '/');
18 }
19 return pattern;
20}
21function createMinimatch(patterns) {
22 return patterns.map(pattern => new minimatch_1.Minimatch(normalize(pattern), { dot: true }));
23}
24exports.createMinimatch = createMinimatch;
25//# sourceMappingURL=paths.js.map
\No newline at end of file