@library-pals/isbn 1.3.0 → 1.3.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@library-pals/isbn",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Find books by ISBN",
5
5
  "exports": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -44,7 +44,9 @@
44
44
  "typescript": "^5.4.5"
45
45
  },
46
46
  "dependencies": {
47
- "axios": "^1.6.8"
47
+ "axios": "^1.6.8",
48
+ "string-strip-html": "^13.4.8",
49
+ "xss": "^1.0.15"
48
50
  },
49
51
  "bugs": {
50
52
  "url": "https://github.com/library-pals/isbn/issues"
@@ -1 +1 @@
1
- {"version":3,"file":"librofm.d.ts","sourceRoot":"","sources":["librofm.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;;GAKG;AACH,qCAJW,MAAM,GACJ,QAAQ,IAAI,CAAC,CAezB;AAED;;;;;;GAMG;AACH,kCALW,MAAM,QACN,MAAM,OACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CAgCzB;AAED;;;GAGG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;GAIG;AACH,+CAHW,MAAM,GACJ,MAAM,CAiBlB;mBA3GY,OAAO,aAAa,EAAE,IAAI;iCAC1B,OAAO,OAAO,EAAE,kBAAkB;;;;;UAgEjC,MAAM;;;;;;SAIN,MAAM;;;;gBACN,MAAM;;;;UACN,MAAM;;;;iBACN,MAAM;;;;UACN,MAAM;;;;WACN,MAAM;;;;cACN,MAAM;;;;YACN,MAAM,EAAE;;;;YACR,MAAM,EAAE;;;;eACR,MAAM;;;;mBACN,MAAM;;;;gBACN,MAAM;;;;cACN,MAAM;;;;oBACN,MAAM,EAAE;;;;YACR,MAAM;;;;iBACN,MAAM"}
1
+ {"version":3,"file":"librofm.d.ts","sourceRoot":"","sources":["librofm.js"],"names":[],"mappings":"AAKA;;;GAGG;AAEH;;;;;GAKG;AACH,qCAJW,MAAM,GACJ,QAAQ,IAAI,CAAC,CAezB;AAED;;;;;;GAMG;AACH,kCALW,MAAM,QACN,MAAM,OACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CAgCzB;AAED;;;GAGG;AACH;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;GAIG;AACH,+CAHW,MAAM,GACJ,MAAM,CAkBlB;mBA5GY,OAAO,aAAa,EAAE,IAAI;iCAC1B,OAAO,OAAO,EAAE,kBAAkB;;;;;UAgEjC,MAAM;;;;;;SAIN,MAAM;;;;gBACN,MAAM;;;;UACN,MAAM;;;;iBACN,MAAM;;;;UACN,MAAM;;;;WACN,MAAM;;;;cACN,MAAM;;;;YACN,MAAM,EAAE;;;;YACR,MAAM,EAAE;;;;eACR,MAAM;;;;mBACN,MAAM;;;;gBACN,MAAM;;;;cACN,MAAM;;;;oBACN,MAAM,EAAE;;;;YACR,MAAM;;;;iBACN,MAAM"}
@@ -1,5 +1,7 @@
1
1
  import { LIBROFM_API_BASE, LIBROFM_API_BOOK } from "../provider-resolvers.js";
2
2
  import axios from "axios";
3
+ import xss from "xss";
4
+ import { stripHtml } from "string-strip-html";
3
5
 
4
6
  /**
5
7
  * @typedef {import('../index.js').Book} Book
@@ -96,6 +98,7 @@ export async function standardize(data, isbn, url) {
96
98
  */
97
99
  export function formatDescription(description) {
98
100
  if (!description) return "";
101
+ description = xss(description);
99
102
  // Replace <br> with a space
100
103
  description = description.replaceAll("<br>", " ");
101
104
  // Replace <b>—</b> with a dash
@@ -103,7 +106,7 @@ export function formatDescription(description) {
103
106
  // Remove bold tags and contents
104
107
  description = description.replaceAll(/<b>.*?<\/b>/g, "");
105
108
  // Remove all other html elements
106
- description = description.replaceAll(/<.*?>/g, "");
109
+ description = stripHtml(description).result;
107
110
  // Trim
108
111
  description = description.trim();
109
112
  // Remove extra spaces