Files
30-seconds-of-code/test/unescapeHTML/unescapeHTML.js
2018-01-09 06:09:49 -05:00

12 lines
165 B
JavaScript

module.exports = str =>
str.replace(
/&|<|>|'|"/g,
tag =>
({
'&': '&',
'&lt;': '<',
'&gt;': '>',
'&#39;': "'",
'&quot;': '"'
}[tag] || tag)
);