-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
What is the recommended way of testing the value in an object? #80
Comments
I think you could combine Doing the unsafe get is just more code and doesn't bring you any benefits that I know of pipe(
collection,
A.filter(
flow(
D.getUnsafe('key'),
F.equals('value')
)
),
A.reject(
d => d.id === 0
),
) |
Yeah, it is way easier to write the callback. Would there be any value in having something like |
I'm not sure if by testing you meant writing tests, but Jest and Vitest have a matcher for it Personally I find very little value in grabbing properties by a string, because it only works at root level of the object and if I want to grab a nested value I will again use a predicate. |
Ok, thanks. Feel free to close this. |
for the code above, our team uses like pipe(
collection,
A.filter(({key})=>key === 'value' ),
A.reject(({id})=>id === 0)
) In my opinion, sometimes, using just pure js' operator gives more readability, since pipe and flows add more unnecessary depth to the code. (hope the pipeline operator comes to the js) |
When using
A.find/filter/reject
, it is often required to do things likeitem => item.key === 'value'
. Is there a better way to write such tests with ts-belt? Something similar topropEq
in ramda.And while i'm here, thanks for this amazing lib! :)
The text was updated successfully, but these errors were encountered: