@cspell/cspell-tools
Version:
Tools to assist with the development of cSpell
16 lines • 542 B
JavaScript
import { importTrie, Trie } from 'cspell-trie-lib';
import { readTextFileLines } from './readTextFile.js';
export async function trieFileReader(filename) {
const trieRoot = importTrie(await readTextFileLines(filename));
const trie = new Trie(trieRoot);
const words = trie.words();
return {
type: 'Trie',
get size() {
return trie.size();
},
lines: words,
hasWord: (word, caseSensitive) => trie.hasWord(word, caseSensitive),
};
}
//# sourceMappingURL=trieFileReader.js.map