Changed picks behaviour to bring an array even when we ask for only one item #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.