shouldIgnore.js
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _minimatch = require('minimatch');
var _minimatch2 = _interopRequireDefault(_minimatch);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (pathName, ignoreList) {
var matched = _lodash2.default.find(ignoreList, function (gb) {
var glob = void 0,
params = void 0;
// Default minimatch params
params = {
matchBase: true
};
if (_lodash2.default.isString(gb)) {
glob = gb;
} else if (_lodash2.default.isObject(gb)) {
glob = gb.glob || '';
// Overwrite minimatch defaults
params = _lodash2.default.assign(params, _lodash2.default.omit(gb, ['glob']));
} else {
glob = '';
}
return (0, _minimatch2.default)(pathName, glob, params);
});
return Boolean(matched);
};