lyndseybrowning / trie-prefix-tree

Create and modify trie prefix structures and extract word lists including prefixes, anagrams and sub-anagrams
49 stars 14 forks source link

Expose the actual tree object for the instance #3

Closed arjunmehta closed 6 years ago

arjunmehta commented 6 years ago

It would be great to have access to the actual tree produced So in addition to myTree.dump(), something like myTrie.tree():

/**
 * Get a the generated trie-tree
*/
tree() {
  return trie;
},

This is useful in cases where there are large trees. I needed to crawl the tree, and the only way I could otherwise do that with this library would be to stringify then parse. However, that has memory implications.

Thoughts? I can create a pull request.

lyndseybrowning commented 6 years ago

Hi arjunmehta,

I'm happy for you to create a pull request 👍

All done. Thanks :)