ensureString

ensureString(s) is String(s || '') — it coerces anything to a string, with falsy inputs staying empty. For a trimmed, optionally length-capped variant see toString. Part of pota/use/string.

Arguments

Argument Type Description
s unknown The value to coerce.

Returns: the value coerced with String(s || ''), so any falsy input (0, null, undefined, '', false, NaN) becomes ''.