fix: Parse Object field value converts from object to array if key contains number
Pull Request
- Report security issues confidentially.
- Any contribution is under this license.
- Link this pull request to an issue.
Issue
Closes: https://github.com/parse-community/Parse-SDK-JS/issues/2198
Approach
Issue demo
Tasks
- [x] Add tests
Thanks for opening this pull request!
@mtrezza this fix would return wrong output e.g.
{ field: 'object', value: { '1x1': 1, '2': 2, '3': 3 } },return as jsonArray which is wrong{ field: 'object', value: { '1': 1 } },return as jsonArray which is also wrong as0index is missing I have created a PR https://github.com/parse-community/Parse-SDK-JS/pull/2206/ which considers these cases as well.
An index of 0 is not required for an array to be an array. See https://github.com/parse-community/Parse-SDK-JS/issues/2198#issuecomment-2210725825.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
b50790a) to head (83066f2). Report is 103 commits behind head on alpha.
Additional details and impacted files
@@ Coverage Diff @@
## alpha #2201 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 61 64 +3
Lines 6186 6358 +172
Branches 1499 1528 +29
==========================================
+ Hits 6186 6358 +172
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@dplewis anything else that should be removed from the changes in https://github.com/parse-community/Parse-SDK-JS/pull/2120/files? Or can we merge
Thats it, this is ready to merge
🎉 This change has been released in version 5.3.0-alpha.2
🎉 This change has been released in version 5.3.0-beta.1
🎉 This change has been released in version 5.3.0