-
Notifications
You must be signed in to change notification settings - Fork 89
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
Curry trouble (example for R.is) #77
Comments
Please try it now with the latest version. |
Hi, |
Hi, |
Ok, so what is your suggestion. |
Yes, that would be consistent with how underscore/lodash work (I guess a lot of people are used to how map() and filter() work there) - return But I guess in the end it must be your decision as lib architect/maintainer. At least |
After such thorough explanation, I have no other option but to integrate your suggestion in the next version of |
...so that everyone can blame me if this proves to be completely wrong. 🤣 |
Same with R.merge(). |
Hi, |
It should be ready by the end of the week. |
All should be fixed with the new version. Reopen, if that is not the case. |
Hi, I don't think that your approach covers all cases (at least, in case of "null" it will throw an exception). Please, see how it's done in Lodash. Your code looks somewhat alike, but not quite.
Do you think it is better to check if arr is an array by "arr.length === undefined"? |
I will consider your latest suggestion in the next release. |
I decided I replaced So I will close the issue, as version
|
Hi,
I understand this has to do with curry, but I constantly have trouble with R.is because of this, so...
The troube comes when I do something like this
if (R.is(Array, someVar)) { ... }
Now, if someVar is undefined then R.is will return function, so the check will pass.
This may happen in a bigger scope, when my function accepts an object A, and one of its fields B should be an array:
So, if B was not defined, the IF block will proceed as if B were an array.
I can add an additional check
if (A.B && R.is(Array, A.B)) { ... }
But that just doesn't feel and look right. Right?
The text was updated successfully, but these errors were encountered: