GitHub 6248★

Unescape HTML special characters

JavaScript version

const unescape = (str) =>
str
.replace(/&/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&#0*39;/g, "'")
.replace(/&quot;/g, '"');

TypeScript version

const unescape = (str: string): string =>
str
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&#0*39;/g, "'")
.replace(/&quot;/g, '"');
Follow me on and to get more useful contents.