Skip to content

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

Open
davidrissato wants to merge 3 commits intopazguille:masterfrom
davidrissato:master
Open

Changed picks behaviour to bring an array even when we ask for only one item#10
davidrissato wants to merge 3 commits intopazguille:masterfrom
davidrissato:master

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