-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(utils): Simplify value normalization (#4666)
This makes a few changes to the internals of `utils.normalize`: - Instead of using `JSON.stringify` to handle the recursive visiting of nodes in an object tree (and then giving it a visit function (`walk`) which is itself a recursive visitor of nodes), forcing us then to call `JSON.parse` on the results, it simply uses said recursive visitor to recursively visit the object tree nodes. - It renames `normalizeValue` to `makeSerializable` (since that's more accurately and specifically what it's doing) and updates its out-of-date docstring to match its behavior. - It refers to the methods in our memoizer by name rather than number, splits out an inlined value, and moves a typecast, all to increase readability.
- Loading branch information
1 parent
bc7b975
commit f715e87
Showing
2 changed files
with
29 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters