Skip to content

Changed picks behaviour to bring an array even when we ask for only one item #10

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davidrissato
Copy link

The way picks currently works make it difficult to retrieve picks array when we don't know exactly how many picks we want, because the behaviour changes when we ask for just one element.

I understood your intentions, but this concept is a little bit confusing.

Just for the records, I took some time to find a bug in my program due to this behaviour, because user could choose how many itens he wanted, and sometimes my program crashed. Otherwise I would need to check if he asked one item and wrap results on an array.

This pull request changes the behaviour of your component. If user specifies options.picks, it will always retrieve an array, even when we ask for only one item. If you don't specify picks, it will retrieve just an object.

Note: This change could be a breaking change if someone relied in options.picks=1 to retrieve an object. If this is a problem, we could add another option like "forceArray", but I think it will be overwhelming.

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

Successfully merging this pull request may close these issues.

1 participant