cafe-utility 4.13.1 → 4.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -834,17 +834,19 @@ function escapeHtml(string) {
834
834
  }
835
835
 
836
836
  const htmlEntityMap = {
837
+ '&': '&',
837
838
  '"': '"',
839
+ ''': "'",
838
840
  '>': '>',
839
- '&lt': '<'
841
+ '&lt;': '<'
840
842
  }
841
843
 
842
844
  function decodeHtmlEntities(string) {
843
845
  let buffer = string
844
846
  .replace(/&#(\d+);/g, (_, dec) => String.fromCharCode(dec))
845
847
  .replace(/&#x(\d+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))
846
- for (const key of Object.keys(htmlEntityMap)) {
847
- buffer = buffer.split(key).join(htmlEntityMap[key])
848
+ for (const [key, value] of Object.entries(htmlEntityMap)) {
849
+ buffer = buffer.replaceAll(key, value)
848
850
  }
849
851
  return buffer
850
852
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "4.13.1",
3
+ "version": "4.13.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {