@serenity-is/corelib / attrEncode
Variable: attrEncode()
constattrEncode: (s) =>string=htmlEncode
Defined in: src/compat/html-compat.ts:31
Legacy alias for htmlEncode.
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>"
Deprecated
Use htmlEncode directly (it also encodes quotes). Retained as attrEncode compat shim.