UNPKG

841 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.createPathsMatcher = (graphite, cwd) => ({
4 cwd,
5 chopCwd(uri) {
6 return uri.slice(cwd.length);
7 },
8 isUriIgnored(uri) {
9 if (!graphite.paths || graphite.paths.ignored.length === 0) {
10 return false;
11 }
12 const choppedUri = this.chopCwd(uri);
13 return graphite.paths.ignored.some(pattern => pattern.test(choppedUri));
14 },
15 isUriReadable(uri) {
16 return !graphite.paths || this.isUriInGroup(uri, graphite.paths.readable);
17 },
18 isUriInGroup(uri, group) {
19 if (group.length === 0) {
20 return true;
21 }
22 const choppedUri = this.chopCwd(uri);
23 return group.some(pattern => pattern.test(choppedUri));
24 },
25});
26//# sourceMappingURL=pathsMatcher.js.map
\No newline at end of file