Skip to content

Can't serialize with trie.T as property is private  #1

Open
@Bishoy

Description

@Bishoy

I might be wrong but since T is a private property of CompactPrefixTree, I'm not sure how the sample would work serializing JSON.stringify(trie.T) and then retrieving the trie back . I would suggest instead something along the lines of :

const items = [
  "http://www.example.com/foo/",
  "https://www.example.com/baz/",
];
const trie = new CompactPrefixTree(items);
const serialized = JSON.stringify(trie);
 
// to deserialize
const trie2 = Object.assign(new CompactPrefixTree(),JSON.parse(serialized))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions