getStringSafely
A safer version of toString(). To avoid getting 'NaN' or other non-real string values. It will coerce strings out of booleans, numbers, objects with their own toString() function, and of course strings.
Lang.getStringSafely(thing)
A safer version of toString(). To avoid getting 'NaN' or other non-real string values. It will coerce strings out of booleans, numbers, objects with their own toString() function, and of course strings.
Parameters
-
thing
{Boolean|String|Object} thing to be converted to string.
Returns
{string | null}
the coerced string, null if unable.