Serialize and deserialize whatever.
npm i serialize-whatever
pnpm add serialize-whatever
yarn add serialize-whatever
# Ptr
# createContext
(extraTypes, ptrs)
# ptrs
 = ...
createContext (extraTypes, ptrs) Â =>
{
# replacer
# (top, clear)
# top
# clear
 = true
(top, clear) Â =>
# (this, key)
# this
# key
(this, key) Â =>
# reviver
# (classes, refs, pending)
# classes
# refs
 = ...
# pending
 = ...
Map <number, Set <[ any, string |
# (result) ]>>
(classes, refs, pending) Â =>
# (this, key, value)
# this
# key
# value
(this, key, value) Â =>
}
# deserialize
(serialized, classes)
# serialized
# classes
 = []
deserialize (serialized, classes) Â =>
# replacer
(top, clear)
# top
# clear
 = true
replacer (top, clear) Â =>
# (this, key)
# this
# key
(this, key) Â =>
# reviver
(classes, refs, pending)
# classes
# refs
 = ...
# pending
 = ...
Map <number, Set <[ any, string |
# (result) ]>>
reviver (classes, refs, pending) Â =>
# (this, key, value)
# this
# key
# value
(this, key, value) Â =>
# serialize
(any, indent, clear)
# any
# indent
# clear
serialize (any, indent, clear) Â =>
# thru
(x)
Fork or edit and submit a PR.
All contributions are welcome!
MIT © 2022 stagas