-
Notifications
You must be signed in to change notification settings - Fork 804
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
Single item / array tip doesn't account for undefined values #42
Comments
Otherwise you get |
Also, usually you do not execute functions to log values to the console, but rather to process data and return values. If I pass a string to a function, I expect a string as return value, or at least not an array. It usually messes up the workflow in which the function is executed. I liked to add something like:
|
@Amberlamps: About the return value: I prefer to get the same type of return value each time I call a function - not a string once and an array the next time. Seems to be personal preference, but I'd say most functions always have a constant return type. |
@BlaM: I agree. But when I use a third party library that converts strings to upper case, I find it weird to get an array when passing a string.
|
@Amberlamps: Usually you wouldn't rely on a third party lib to uppercase strings - you would use String.toUpperCase() 😋. But in the end it all comes down to the definition of the function. There is no right or wrong here - and returning uppercase is just an example. |
Hey can we close this? |
My original comment was not addressed. You guys went off on a tangent. 😄 |
@boneskull if you have any improvements can you submit a new PR? Or let us know if this can be closed. |
Modify tip to avoid throwing; closes #42
Maybe better to
value = [].concat(value || [])
The text was updated successfully, but these errors were encountered: