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
Are there any suggestions on how to implement these two helpers?
constgraph=newDepGraph()// adding nodes a, b, c, d, etcconstserializedGraph: Record<string,unknown>=serialize(graph)// unknown could be a specific typeconstinsertedRow=database.insert({ serializedGraph })// putting serialized graph into a database using something like prisma or sequelizeconstconst deserializedGraph: DepGraph<T>=deserialize(insertedRow.serializedGraph)// T could be a specific type as well
Great library!
The text was updated successfully, but these errors were encountered:
I've been hesitant to add any sort of official serialization/deserialization support to this library as it's possible to add data to the graph that is not serializable.
Ah, this wasn't an intentional change (although there's never really been a promise that the graph is JSON-serializable)
The only thing I worry about adding an official toJSON() / fromJSON(string) is that it's possible for someone who is using this library to add a node that has data attached that is not JSON.stringifyable (e.g. as you've shown a Map, or a Function, etc) and it's not clear what the output should be (fromJSON(graph.toJSON()) would not return the same thing)
Are there any suggestions on how to implement these two helpers?
Great library!
The text was updated successfully, but these errors were encountered: