Skip to content

Commit 756aec5

Browse files
authored
Create 1410-html-entity-parser.js
1 parent 352b6b5 commit 756aec5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

1410-html-entity-parser.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @param {string} text
3+
* @return {string}
4+
*/
5+
const entityParser = function(text) {
6+
const q = /"/g
7+
const s = /'/g
8+
const a = /&/g
9+
const g = />/g
10+
const l = /</g
11+
const sl = /⁄/g
12+
let t = text.replace(q, '"')
13+
t = t.replace(q, '"')
14+
t = t.replace(s, "'")
15+
t = t.replace(g, '>')
16+
t = t.replace(l, '<')
17+
t = t.replace(sl, '/')
18+
t = t.replace(a, '&')
19+
return t
20+
};

0 commit comments

Comments
 (0)