@kamilmielnik/trie
Version:
Trie data structure implementation in TypeScript. Highly performant. No dependencies. Built for a Scrabble Solver.
17 lines (16 loc) • 481 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromArray = void 0;
const add_1 = require("./add");
/**
* Creates a new {@link Node} based on array of words.
*
* @param words - array of words to put in the {@link Node}.
* @returns New {@link Node} containing all given words.
*/
const fromArray = (words) => {
const node = {};
words.forEach((word) => (0, add_1.add)(node, word));
return node;
};
exports.fromArray = fromArray;