Function: trimToEmpty()
trimToEmpty(
value):string
trimToNull with an empty-string miss instead of null, for callers
that build a string unconditionally and treat “absent” as “”.
Reading loosely-typed JSON is the motivating case: a field that should be a
string may be missing or the wrong type, and the caller wants "" rather
than a null check at every access.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”string
Example
Section titled “Example”const title = trimToEmpty(record.title); // always a string