UNPKG

@kamilmielnik/trie

Version:

Trie data structure implementation in TypeScript. Highly performant. No dependencies. Built for a Scrabble Solver.

17 lines (16 loc) 502 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.has = void 0; const find_1 = require("./find"); /** * 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. */ const has = (node, word) => { const foundNode = (0, find_1.find)(node, word); return Boolean(foundNode?.wordEnd); }; exports.has = has;