Closed markskroba closed 2 years ago
Don't listen to @thehabes, Your method is string to language map and this allows you to reuse it for more things than
label
. It looks great. Consider, there may be times when this errors (for example when a non-string is passed in). Probably what you want is for it to break when you do this, since it is a helper, but there may be other cases upstream where you would like to fill in placeholder labels or empty strings or remove the value completely without breaking the process, so catching and returning anull
might be desirable.
It does look great. Parse my words how is most effective, even by dropping them all.
Don't listen to @thehabes, Your method is string to language map and this allows you to reuse it for more things than
label
. It looks great. Consider, there may be times when this errors (for example when a non-string is passed in). Probably what you want is for it to break when you do this, since it is a helper, but there may be other cases upstream where you would like to fill in placeholder labels or empty strings or remove the value completely without breaking the process, so catching and returning anull
might be desirable.