Turns the passed variable into an empty string if the type is undefined, otherwise typecasts to string and trims off leading/trailing whitespace.
This is useful for cases where you are unsure of the variable's content. Used internally several times in the elementals.js codebase.
- Calling Convention:
- The variable to typecast to string and trim.
- The "normalized" string.
Console.log(_.stringNormalize(' this is a test '));
Will output the string with the whitespace removed from it.