fix: playground edit message
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const htmlUnescapes: Record<string, string> = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
''': "'"
|
||||
};
|
||||
|
||||
const reEscapedHtml = /&(?:amp|lt|gt|quot|#(?:0+)?39);/g;
|
||||
const reHasEscapedHtml = RegExp(reEscapedHtml.source);
|
||||
|
||||
export const unescape = (str = '') => {
|
||||
return reHasEscapedHtml.test(str)
|
||||
? str.replace(reEscapedHtml, (entity) => htmlUnescapes[entity] || "'")
|
||||
: str;
|
||||
};
|
||||
Reference in New Issue
Block a user