mobxjs / serializr

Serialize and deserialize complex object graphs to and from JSON and Javascript classes
MIT License
766 stars 52 forks source link

feat: made `invariant` be able to output json / object more readable #68

Closed chengjianhua closed 5 years ago

chengjianhua commented 7 years ago

(#62)

I refer to the implementation of debug.

In addition to stringifying json data, it also output the non-string objects to console by console.log(). It's useful that if we want to inspect a complicated object that contains many hidden properties (e.g. observable in mobx) while update / deserialize failed particularly.

The final effect like below:

image

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.8%) to 90.309% when pulling 83c010a0bd8d600efa19100e9dcab21ec8f3ac86 on chengjianhua:feat/readable-invariant into 59fe6e569ec72c102bc8ed3a2ec3697edea35bf0 on mobxjs:master.

chengjianhua commented 6 years ago

@mweststrate Do you think this approach is okay ? Or give some suggestions ?

I hope this to be accepted as soon as possible. While I deserialize / serialize the object withe deep complex structure, it took me too much time to debug out which part is illegal.

I think this do help others too.

1R053 commented 5 years ago

@chengjianhua thanks, has been added in v1.5.0.