Total Complexity | 9 |
Complexity/F | 3 |
Lines of Code | 35 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /* |
||
6 | 'use strict' |
||
7 | |||
8 | const minimatch = require('minimatch') |
||
9 | const Module = require('../containers/Module') |
||
10 | |||
11 | const matchFile = function (options, path) { |
||
12 | if (typeof options.paths === 'string') { |
||
13 | options.paths = [options.paths] |
||
14 | } |
||
15 | |||
16 | for (var i in options.paths) { |
||
17 | if (!options.paths.hasOwnProperty(i)) { |
||
18 | continue |
||
19 | } |
||
20 | if (minimatch(path, options.paths[i])) { |
||
21 | return true |
||
22 | } |
||
23 | } |
||
24 | |||
25 | return false |
||
26 | } |
||
27 | |||
28 | let manifest |
||
29 | Module.getManifest(function (manifestObj) { |
||
30 | manifest = manifestObj |
||
31 | }) |
||
32 | |||
33 | module.exports = function (path) { |
||
34 | var options = manifest.getDevOption('ignore') |
||
35 | if (!options || !('paths' in options)) { |
||
36 | return false |
||
37 | } |
||
38 | |||
39 | return matchFile(options, path) |
||
40 | } |
||
41 |