mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 04:21:53 +08:00
Chore: introduce eslint to build script
This commit is contained in:
@@ -31,6 +31,24 @@ class Trie {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} suffix
|
||||
*/
|
||||
contains(suffix) {
|
||||
let node = this.root;
|
||||
let token;
|
||||
|
||||
for (let i = suffix.length - 1; i >= 0; i--) {
|
||||
token = suffix[i];
|
||||
|
||||
node = node[token];
|
||||
|
||||
if (node == null) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to retrieve every item in the trie with the given prefix.
|
||||
*
|
||||
@@ -42,8 +60,6 @@ class Trie {
|
||||
let node = this.root;
|
||||
const matches = [];
|
||||
let token;
|
||||
let i;
|
||||
let l;
|
||||
|
||||
for (let i = suffix.length - 1; i >= 0; i--) {
|
||||
token = suffix[i];
|
||||
|
||||
Reference in New Issue
Block a user