Skip to content

Commit

Permalink
Use early return and remove a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Karim-30 committed Oct 19, 2022
1 parent af2dff7 commit 4f790a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/libs/EmojiTrie.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import CONST from '../CONST';

Timing.start(CONST.TIMING.TRIE_INITIALIZATION);

// Create a Trie object
const emojisTrie = new Trie();

// Inserting all emojis into the Trie object
Expand Down
5 changes: 2 additions & 3 deletions src/libs/Trie/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,10 @@ class Trie {
let prefix = '';
for (let i = 0; i < newSubstr.length; i++) {
prefix += newSubstr[i];
if (node.children[newSubstr[i]]) {
node = node.children[newSubstr[i]];
} else {
if (!node.children[newSubstr[i]]) {
return [];
}
node = node.children[newSubstr[i]];
}
return this.getChildMatching(node, prefix, limit, []);
}
Expand Down

0 comments on commit 4f790a8

Please sign in to comment.