@library-pals/isbn 1.4.2 → 1.4.4
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 +8 -8
- package/src/index.js +1 -0
- package/src/providers/librofm.js +1 -0
- package/src/providers/open-library.js +13 -1
- package/types/index.d.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@library-pals/isbn",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "Find books by ISBN",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"author": "Katy DeCorah <@katydecorah>",
|
|
38
38
|
"license": "AGPL-3.0-or-later",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@eslint/js": "^9.
|
|
41
|
-
"eslint": "^9.
|
|
42
|
-
"eslint-plugin-jest": "^28.
|
|
43
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
40
|
+
"@eslint/js": "^9.17.0",
|
|
41
|
+
"eslint": "^9.17.0",
|
|
42
|
+
"eslint-plugin-jest": "^28.10.0",
|
|
43
|
+
"eslint-plugin-jsdoc": "^50.6.1",
|
|
44
44
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
45
|
-
"globals": "^15.
|
|
45
|
+
"globals": "^15.14.0",
|
|
46
46
|
"jest": "^29.7.0",
|
|
47
|
-
"prettier": "^3.4.
|
|
47
|
+
"prettier": "^3.4.2",
|
|
48
48
|
"prettier-2": "npm:prettier@^2",
|
|
49
49
|
"typescript": "^5.7.2"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"axios": "^1.7.
|
|
52
|
+
"axios": "^1.7.9"
|
|
53
53
|
},
|
|
54
54
|
"bugs": {
|
|
55
55
|
"url": "https://github.com/library-pals/isbn/issues"
|
package/src/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
* @property {string | undefined} [thumbnail] - The thumbnail image link of the book.
|
|
20
20
|
* @property {string} [link] - The link of the book.
|
|
21
21
|
* @property {string} bookProvider - The provider of the book information.
|
|
22
|
+
* @property {string} [duration] - The duration of the audiobook.
|
|
22
23
|
*/
|
|
23
24
|
|
|
24
25
|
/**
|
package/src/providers/librofm.js
CHANGED
|
@@ -110,7 +110,7 @@ export async function standardize(book, isbn) {
|
|
|
110
110
|
const standardBook = {
|
|
111
111
|
title: book.title,
|
|
112
112
|
authors,
|
|
113
|
-
description,
|
|
113
|
+
description: handleDescription(description),
|
|
114
114
|
pageCount: book.number_of_pages,
|
|
115
115
|
format: "book",
|
|
116
116
|
categories: subjects,
|
|
@@ -128,6 +128,18 @@ export async function standardize(book, isbn) {
|
|
|
128
128
|
return standardBook;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Handles the description of the book.
|
|
133
|
+
* @param {string|object} description - The description of the book.
|
|
134
|
+
* @returns {string} - The processed description.
|
|
135
|
+
*/
|
|
136
|
+
function handleDescription(description) {
|
|
137
|
+
if (typeof description === "string") {
|
|
138
|
+
return description;
|
|
139
|
+
}
|
|
140
|
+
return description.value;
|
|
141
|
+
}
|
|
142
|
+
|
|
131
143
|
/**
|
|
132
144
|
* Retrieves the author names from OpenLibrary.
|
|
133
145
|
* @param {{key: string}[]} rawAuthors - List of author keys.
|
package/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @property {string | undefined} [thumbnail] - The thumbnail image link of the book.
|
|
14
14
|
* @property {string} [link] - The link of the book.
|
|
15
15
|
* @property {string} bookProvider - The provider of the book information.
|
|
16
|
+
* @property {string} [duration] - The duration of the audiobook.
|
|
16
17
|
*/
|
|
17
18
|
/**
|
|
18
19
|
* @typedef {import('./provider-resolvers.js').Providers} Providers
|
|
@@ -98,6 +99,10 @@ export type Book = {
|
|
|
98
99
|
* - The provider of the book information.
|
|
99
100
|
*/
|
|
100
101
|
bookProvider: string;
|
|
102
|
+
/**
|
|
103
|
+
* - The duration of the audiobook.
|
|
104
|
+
*/
|
|
105
|
+
duration?: string;
|
|
101
106
|
};
|
|
102
107
|
export type Providers = import("./provider-resolvers.js").Providers;
|
|
103
108
|
export type AxiosRequestConfig = import("axios").AxiosRequestConfig;
|