Apply prefer-const lint rule

This commit is contained in:
Zaid Abdulla committed 2018-08-25 16:14:34 -07:00
1 parent b43088c03c
commit 09e6a360af
26 files changed
+217 -215

No files matched your search

+14 -14
View File
@@ -29,7 +29,7 @@ class PathSet {
}
add(path) {
let p = this.get(path);
const p = this.get(path);
if (p) return p;
@@ -40,7 +40,7 @@ class PathSet {
let wildcard = 0;
for (let i = 0; i < path.length; ++i) {
let fragment = path[i];
const fragment = path[i];
if (fragment === "*") wildcard = wildcard | (1 << i);
if (!this.fragmentIndex[i]) this.fragmentIndex[i] = {};
@@ -64,14 +64,14 @@ class PathSet {
if (this.lengthIndex[pattern.length].has(pattern)) return pattern;
let sets = [];
const sets = [];
sets.push(this.lengthIndex[pattern.length]);
for (let i = 0; i < pattern.length; ++i) {
if (!this.fragmentIndex[i]) return null;
let fragment = pattern[i];
const fragment = pattern[i];
if (!this.fragmentIndex[i][fragment]) return null;
@@ -82,9 +82,9 @@ class PathSet {
return a.size - b.size;
});
let smallestSet = sets.shift();
const smallestSet = sets.shift();
for (let path of smallestSet) {
for (let s of sets) {
for (const s of sets) {
if (!s.has(path)) {
path = null;
break;
@@ -98,8 +98,8 @@ class PathSet {
}
find(pattern, superset = false, subset = false, depth = pattern.length) {
let res = [];
let groups = [[]];
const res = [];
const groups = [[]];
for (let i = pattern.length; i <= depth; ++i)
if (this.lengthIndex[i]) groups[0].push(this.lengthIndex[i]);
@@ -109,11 +109,11 @@ class PathSet {
for (let i = 0; i < pattern.length; ++i) {
if (!this.fragmentIndex[i]) return res;
let fragment = pattern[i];
const fragment = pattern[i];
if (fragment === "*" && subset) continue;
let g = [];
const g = [];
if (this.fragmentIndex[i][fragment])
g.push(this.fragmentIndex[i][fragment]);
@@ -137,12 +137,12 @@ class PathSet {
);
});
let smallestGroup = groups.shift();
for (let set of smallestGroup) {
const smallestGroup = groups.shift();
for (const set of smallestGroup) {
for (let path of set) {
for (let group of groups) {
for (const group of groups) {
let found = false;
for (let s of group) {
for (const s of group) {
if (s.has(path)) {
found = true;
break;