minimalistic-server 0.0.44 → 0.0.46

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 (3) hide show
  1. package/README.md +2 -1
  2. package/index.mjs +15 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,2 +1,3 @@
1
1
  # node-minimalistic-server
2
- Minimalistic server library for Node.js. It supports routing, middlewares, parsing common request bodies (JSON, form data, etc), static file serving.
2
+ Minimalistic server library for Node.js. It supports routing, middlewares, parsing common request bodies (JSON, form data, etc), static file serving.
3
+ In order to see how it works, you can download and run this [demo project](https://github.com/surenenfiajyan/files/raw/refs/heads/main/gallery.zip).
package/index.mjs CHANGED
@@ -2084,11 +2084,21 @@ export function serve(routes, port = 80, staticFileDirectoryOrDirectories = null
2084
2084
  }
2085
2085
 
2086
2086
  export function escapeHtml(htmlStr) {
2087
- return htmlStr?.toString().replace(/&/g, "&")
2088
- .replace(/</g, "&lt;")
2089
- .replace(/>/g, "&gt;")
2090
- .replace(/"/g, "&quot;")
2091
- .replace(/'/g, "&#39;") ?? '';
2087
+ return htmlStr?.toString()
2088
+ .replace(/&/gm, "&amp;")
2089
+ .replace(/</gm, "&lt;")
2090
+ .replace(/>/gm, "&gt;")
2091
+ .replace(/"/gm, "&quot;")
2092
+ .replace(/'/gm, "&#39;") ?? '';
2093
+ }
2094
+
2095
+ export function unescapeHtml(htmlStr) {
2096
+ return htmlStr?.toString()
2097
+ .replace(/&amp;/gm, "&")
2098
+ .replace(/&lt;/gm, "<")
2099
+ .replace(/&gt;/gm, ">")
2100
+ .replace(/&quot;/gm, '"')
2101
+ .replace(/&#39;/gm, "'") ?? '';
2092
2102
  }
2093
2103
 
2094
2104
  export function unserve(port = 80) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimalistic-server",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "engines" : {
5
5
  "npm" : ">=8.6.0",
6
6
  "node" : ">=22.0.0"