CenterForDigitalHumanities / TPEN28

Split front/back ends from each other
3 stars 2 forks source link

string to language map function, closes #627 #628

Closed markskroba closed 2 years ago

cubap commented 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 a null might be desirable.

thehabes commented 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 a null might be desirable.

It does look great. Parse my words how is most effective, even by dropping them all.