I noticed when reading through this that there's quite a bit of code duplication for string normalization. Everywhere a string is normalized it's first evaluated as a boolean, then set as an empty string if false, then the resulting string is normalized with .normalize('NFKD').
This PR DRYs up the code with a simpler normalize(str?) function that always ensures those actions are taken.
I think it makes the code quite a bit more readable, especially considering the line length wrapping we enforce.
I noticed when reading through this that there's quite a bit of code duplication for string normalization. Everywhere a string is normalized it's first evaluated as a boolean, then set as an empty string if false, then the resulting string is normalized with
.normalize('NFKD')
.This PR DRYs up the code with a simpler
normalize(str?)
function that always ensures those actions are taken.I think it makes the code quite a bit more readable, especially considering the line length wrapping we enforce.
e.g this:
becomes this: