Closed NicolasMahe closed 4 years ago
Let's not start to specify how to encode every special type. The lib should check if the function toJSON is implemented and call it if it is. Otherwise, maybe simple call JSON.stringify?
toJSON
JSON.stringify
Function to improve: https://github.com/mesg-foundation/mesg-js/blob/d0844fde085d3b797f076a56152a867c7dc3ac4f/src/util/encoder.ts#L3-L30
Originally posted by @NicolasMahe in https://github.com/mesg-foundation/mesg-js/pull/116/files#r309583299
Let's also take a look at the decode functions to see if we can do a similar reversed system.
Issue migrated to liteflow-labs/liteflow-js#66
Let's not start to specify how to encode every special type. The lib should check if the function
toJSON
is implemented and call it if it is. Otherwise, maybe simple callJSON.stringify
?Function to improve: https://github.com/mesg-foundation/mesg-js/blob/d0844fde085d3b797f076a56152a867c7dc3ac4f/src/util/encoder.ts#L3-L30
Originally posted by @NicolasMahe in https://github.com/mesg-foundation/mesg-js/pull/116/files#r309583299