diff --git a/package-lock.json b/package-lock.json index f60752e..62f968a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "flibusta", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "flibusta", - "version": "0.5.0", + "version": "0.5.1", "license": "MIT", "dependencies": { "axios": "1.2.6", diff --git a/package.json b/package.json index 313b778..70d7463 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flibusta", - "version": "0.5.0", + "version": "0.5.1", "author": "ynhhoJ", "description": "Unofficial Flibusta API based on website search engine. If you like to read books - buy", "license": "MIT", @@ -29,7 +29,7 @@ "example-search-genres-paginated": "ts-node ./examples/searchGenresPaginated.ts", "test": "npm run test:specific 'tests/**/*.ts'", "test:specific": "npx nyc mocha --timeout 15000 --node-flags '--unhandled-rejections=strict' -r ts-node/register", - "build": "webpack && yarn copy-types", + "build": "webpack && npm run copy-types", "copy-types": "copyfiles -u 1 types/**/* build/types" }, "dependencies": { diff --git a/src/api/getBooksByAuthorOpds.ts b/src/api/getBooksByAuthorOpds.ts index b080af6..b524abc 100644 --- a/src/api/getBooksByAuthorOpds.ts +++ b/src/api/getBooksByAuthorOpds.ts @@ -69,7 +69,12 @@ class GetBooksByAuthorOpds extends FlibustaAPIHelper { return undefined; } - const slicedEntryToLimit = entry.slice(0, limit); + let slicedEntryToLimit = entry; + + if (Array.isArray(slicedEntryToLimit)) { + slicedEntryToLimit = slicedEntryToLimit.slice(0, limit); + } + const items = this.prepareResponseFromOpdsEntry(slicedEntryToLimit); const pages = this.getCurrentOpdsPageInformation(feed, page); diff --git a/src/api/getBooksByNameOpds.ts b/src/api/getBooksByNameOpds.ts index 3c509fe..533a83e 100644 --- a/src/api/getBooksByNameOpds.ts +++ b/src/api/getBooksByNameOpds.ts @@ -94,7 +94,12 @@ class GetBooksByNameOpds extends FlibustaAPIHelper { return undefined; } - const slicedEntryToLimit = entry.slice(0, limit); + let slicedEntryToLimit = entry; + + if (Array.isArray(slicedEntryToLimit)) { + slicedEntryToLimit = slicedEntryToLimit.slice(0, limit); + } + const items = this.prepareResponseFromOpdsEntry(slicedEntryToLimit); const pages = this.getCurrentSearchOpdsPageInformation(feed); const totalCountItems = feed['os:totalResults'];