@serenity-is/corelib / htmlEncode
Function: htmlEncode()
htmlEncode(
s):string
Defined in: src/base/html.ts:33
HTML-encodes a value by escaping <, >, ", ', and &.
Parameters
s
any
Value to encode. Non-string values are coerced to string; null/undefined yields an empty string.
Returns
string
The HTML-escaped string, safe for interpolation into HTML markup.
Example
htmlEncode('<a href="x">a & b</a>'); // "<a href="x">a & b</a>"