You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BTree should be serialized in array form, like this:
let btree1 = new BTree<number>([[1, 'one'], [2, 2.22]]);
let json = JSON.stringify([... btree1.entries()]);
let btree2 = new BTree<number>(JSON.parse(json));
If you use JSON.stringify you'll get the internal contents of the BTree as JSON, and (1) I don't know any way to reconstruct the BTree object from that, (2) but if I did, I would still advise against storing it that way because future versions could theoretically use different names for private properties.
What would be the best method for serialization of a sorted btree (using interface
ISortedMap
)?Is it safe to use JSON.stringify, or would you recommend serializing the iterable and then reconstructing the tree from the resulting array?
The text was updated successfully, but these errors were encountered: