Skip to content

Commit ea2987c

Browse files
author
Simon he
committed
chore: add unescapeHtml
1 parent 8d4313b commit ea2987c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/unescapeHtml.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function unescapeHtml(s: string): string {
2+
return s.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g, tag => ({ '&amp;': '&', '&lt;': '<', '&gt;': '>', '&#39;': '\'', '&quot;': '"' }[tag] || tag))
3+
}

0 commit comments

Comments
 (0)