mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-24 03:32:58 +03:00
729 B
729 B
unescape
Converts the HTML entities &
, <
, >
, "
, and '
in str
to their corresponding characters. It is the inverse of escape
.
Signature
function unescape(str: string): string;
Parameters
str
(string
): The string to unescape.
Returns
(string
): The unescaped string.
Examples
import { unescape } from 'es-toolkit/string';
unescape('This is a <div> element.'); // returns 'This is a <div> element.'
unescape('This is a "quote"'); // returns 'This is a "quote"'
unescape('This is a 'quote''); // returns 'This is a 'quote''
unescape('This is a & symbol'); // returns 'This is a & symbol'