In Underscore, you can use the _.unescape
function to convert HTML entities to their corresponding characters.
Here is an example usage:
index.tsx177 chars5 lines
In the above example, we have a string that contains HTML entities, such as <
for <
and "
for "
. We pass this string to the _.unescape
function, which returns the unescaped version of the string.
Note that this function can also handle other types of escaping, such as Unicode escape sequences (\uXXXX
) and JavaScript escape sequences (\n
, \t
, etc.).
gistlibby LogSnag