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