Skip to content

Commit

Permalink
Clean-up.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Apr 30, 2019
1 parent 2de2f9c commit 6e94ca2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ const flatten = (list, result = []) => {
return result;
};

const back = /\\/g;
const double = /\/\//;
const backslash = /\\/g;
const slash = '/';
const doubleslash = /\/\//;
const braceStart = '{';
const dotRe = /\..*\.(sw[px])$|\~$|\.subl.*\.tmp/;
const replacerRe = /^\.[\/\\]/;
const emptyFn = () => {};

const toUnix = (string) => {
let str = string.replace(back, slash);
while (str.match(double)) {
str = str.replace(double, slash);
let str = string.replace(backslash, slash);
while (str.match(doubleslash)) {
str = str.replace(doubleslash, slash);
}
return str;
};
Expand All @@ -70,10 +74,6 @@ const normalizeIgnored = (cwd = '') => (path) => {
return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path));
};

const dotRe = /\..*\.(sw[px])$|\~$|\.subl.*\.tmp/;
const replacerRe = /^\.[\/\\]/;
const emptyFn = () => {};

/**
* Directory entry.
* @property {Path} path
Expand Down Expand Up @@ -670,7 +670,7 @@ _getWatchHelpers(path, depth) {
const {stats} = entry;
if (stats && stats.isSymbolicLink()) return filterDir(entry);
const resolvedPath = entryPath(entry);
const matchesGlob = !hasGlob || globFilter(resolvedPath);
const matchesGlob = hasGlob ? globFilter(resolvedPath) : true;
return matchesGlob &&
this._isntIgnored(resolvedPath, stats) &&
this._hasReadPermissions(stats);
Expand All @@ -679,7 +679,7 @@ _getWatchHelpers(path, depth) {
const getDirParts = (path) => {
if (!hasGlob) return [];
const parts = [];
const expandedPath = path.includes("{")
const expandedPath = path.includes(braceStart)
? braces.expand(path)
: [path];
expandedPath.forEach((path) => {
Expand Down

0 comments on commit 6e94ca2

Please sign in to comment.