parse-community / Parse-SDK-JS

The JavaScript SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
1.32k stars 596 forks source link

fix: `Parse.Object.get` returns array instead of object if key name is number-like #2201

Closed mtrezza closed 3 months ago

mtrezza commented 3 months ago

Pull Request

Issue

Closes: https://github.com/parse-community/Parse-SDK-JS/issues/2198

Approach

Issue demo

Tasks

parse-github-assistant[bot] commented 3 months ago

Thanks for opening this pull request!

mkmandar123 commented 3 months ago

@mtrezza this fix would return wrong output e.g.

  1. { field: 'object', value: { '1x1': 1, '2': 2, '3': 3 } }, return as jsonArray which is wrong
  2. { field: 'object', value: { '1': 1 } }, return as jsonArray which is also wrong as 0 index is missing I have created a PR https://github.com/parse-community/Parse-SDK-JS/pull/2206/ which considers these cases as well.
mtrezza commented 3 months ago

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[bot] commented 3 months ago

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 ```diff @@ 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.

mtrezza commented 3 months ago

@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

dplewis commented 3 months ago

Thats it, this is ready to merge

parseplatformorg commented 3 months ago

🎉 This change has been released in version 5.3.0-alpha.2

parseplatformorg commented 3 months ago

🎉 This change has been released in version 5.3.0-beta.1

parseplatformorg commented 3 months ago

🎉 This change has been released in version 5.3.0