Skip to content

Conversation

@NaseeraA
Copy link

No description provided.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why? :)

@NaseeraA
Copy link
Author

The function fails with nil input. Currently, I'm using guards to check for non-nil values before invoking the function.

if  payment_status,
do:  payment_status |> Recase.to_sentence() ,
else:  ""

@sobolevn
Copy link
Member

What's wrong with that? You can pattern match on your own inputs instead. This operation "recase" only makes sense on binary input, not on nil.

@NaseeraA
Copy link
Author

Agreed, you can.

The disadvantage though is that my code is littered with checks preceding each call to recase. An optional default parameter would be great. Alternatively, we could wrap all of our calls to recase internally within our project.
Thanks

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.

2 participants