@kamilmielnik/trie
Version:
Trie data structure implementation in TypeScript. Highly performant. No dependencies. Built for a Scrabble Solver.
13 lines (12 loc) • 379 B
JavaScript
import { find } from './find.js';
/**
* Tells you whether given word is in the {@link Node}.
*
* @param node - {@link Node} to look for word in.
* @param word - Word to be found.
* @returns true if given word is in the {@link Node}, false otherwise.
*/
export const has = (node, word) => {
const foundNode = find(node, word);
return Boolean(foundNode?.wordEnd);
};