Untransposing Object With Hyphen as Property Doesn't Work Correctly#1
Merged
henrytseng merged 3 commits intohenrytseng:masterhenrytseng/dataobject-parser:masterfrom Jun 24, 2014
DavidTPate:masterCopy head branch name to clipboard
Merged
Untransposing Object With Hyphen as Property Doesn't Work Correctly#1henrytseng merged 3 commits intohenrytseng:masterhenrytseng/dataobject-parser:masterfrom DavidTPate:masterCopy head branch name to clipboard
henrytseng merged 3 commits intohenrytseng:masterhenrytseng/dataobject-parser:masterfrom
DavidTPate:masterCopy head branch name to clipboard
Conversation
henrytseng
pushed a commit
that referenced
this pull request
Jun 24, 2014
Untransposing Object With Hyphen as Property Doesn't Work Correctly
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using the library to untranspose an object which has a hyphen (or similar character) in the property name it is not correctly untransposed into a structured object.
For example, given an object like:
It is properly transposed to:
But, when attempting to untranspose it the following is the result:
I took a look at how this is being handled and it looks like this result is being caused by the Regular Expression that is used to untranspose. My initial suggestion would be to handle this by having the following when transposing, for the example above:
But from looking through the rest of the library this looks like it would cause a conflict since instead of being treated as a property it would be treated as an array. Based on that requiring a lot of refactoring I just modified the regular expression to target hyphens so that they are properly parsed as part of the property name, not a child object.