-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support native Date type, Components, improved RegExp, new CustomValue API #474
Conversation
@@ -43,7 +43,8 @@ export function stringify (data) { | |||
return CircularJSON.stringify(data, replacer) | |||
} | |||
|
|||
function replacer (key, val) { | |||
function replacer (key) { | |||
const val = this[key] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yyx990803 This is to prevent the default replacer to turn Dates into Strings before calling the custom replacer. See WebReflection/circular-json#4
I added a new |
I have made some changes on #486 to make the CustomValue API much more powerful. For example: https://gist.github.com/Akryum/f2e08df47088d5be0f933b67e90261dc |
} | ||
|
||
export function reduceStateList (list) { | ||
if (!list.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor, but you can write this as if (!list.length) return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, tested too 🙂
I think some of the code in the devtools could use some comments as my personal experience with it is always a bit hard: it's not easy to get into it to do a small feature. I wonder if you felt that way too at the beginning @Akryum
Fix #475 Fix #460
This PR improves
Date
and components support:_custom
API.Example for components:
Other example: https://gist.github.com/Akryum/f2e08df47088d5be0f933b67e90261dc