source:
node_modules/es-toolkit/dist/string/unescape.mjs
| Last change on this file was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 261 bytes | |
| Line | |
|---|---|
| 1 | const htmlUnescapes = { |
| 2 | '&': '&', |
| 3 | '<': '<', |
| 4 | '>': '>', |
| 5 | '"': '"', |
| 6 | ''': "'", |
| 7 | }; |
| 8 | function unescape(str) { |
| 9 | return str.replace(/&(?:amp|lt|gt|quot|#(0+)?39);/g, match => htmlUnescapes[match] || "'"); |
| 10 | } |
| 11 | |
| 12 | export { unescape }; |
Note:
See TracBrowser
for help on using the repository browser.
