Skip to content
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

Default array should be created only if the key is a number and the index is in order #42

Closed
wants to merge 2 commits into from

Conversation

boatkorachal
Copy link

The use case is when i use updeep to update the entities that normalized from normalizr package (https://github.com/gaearon/normalizr) and the ids are number.

But this will not fix the problem if the updated ids is happen to be in order (luckily most database has an incremental id field begins from 1 haha).

In my opinion, If there is an existing array, the update operation makes sense. But if there is no existing array, the new array should not be created

What do you think?

@aaronjensen
Copy link
Member

These are good points.

@mindjuice you suggested defaulting to an array if the key was a number, but this incompatibility w/ normilizer (and just using numbers as keys in general) seems like a bigger deal to me.

I'm not sure that defaulting to an array in any case is the right answer, so I'm tending to agree w/ you, @boatkorachal.

@astephenb do you all ever rely on the default to array behavior?

@a-b-r-o-w-n
Copy link
Contributor

@aaronjensen I don't think we ever rely on updeep's default array behavior. We do use u.withDefault with an array though.

@aaronjensen
Copy link
Member

@boatkorachal I reverted #34 and released 0.11.0, hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants