rename function
This commit is contained in:
parent
d363d73dbd
commit
1fa47d4abd
2 changed files with 8 additions and 8 deletions
|
|
@ -105,7 +105,7 @@ export const insert = trie => key => value => {
|
|||
};
|
||||
|
||||
// given a prefix, return a string X such that prefix+X is a possibly larger prefix for the same entries as the original prefix.
|
||||
export const growKey = trie => key => {
|
||||
export const growPrefix = trie => key => {
|
||||
const [pos, prefix] = binarySearch(trie.children, key);
|
||||
if (prefix.length === 0) {
|
||||
return "";
|
||||
|
|
@ -121,7 +121,7 @@ export const growKey = trie => key => {
|
|||
}
|
||||
if (key.length > haveKey.length) {
|
||||
if (key.startsWith(haveKey)) {
|
||||
return growKey(haveChildNode)(key.slice(haveKey.length));
|
||||
return growPrefix(haveChildNode)(key.slice(haveKey.length));
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue