flow-immutable-models
flow-immutable-models copied to clipboard
Provide `toJS` and `toJSON` functions
In order to support serialization, provide a toJS
(and toJSON
alias) function to convert the ImmutableModel into its modelType form.
Why didn't you add toJSON
? I think that toJSON
would be a lot faster than toJS
to encode the model as a string. Is that right?
Yeah, you're right. I'll put together a pull request to add toJSON
as a shallow operation which will work better when using JSON.stringify
I'm going to hold off on this until Immutable-JS 4.0.0 is released. The current version doesn't have correct flow types for the toJSON
function.