Skip to content

Commit

Permalink
Merge pull request #41 from Nem4/master
Browse files Browse the repository at this point in the history
🚧Refactor examples
  • Loading branch information
ynhhoJ authored Aug 8, 2023
2 parents 0b0a910 + 904e47c commit db232d1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion examples/searchAuthors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FlibustaAPI from '@src/index';
(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, authorName] = process.argv;
const flibustaApi = new FlibustaAPI('http://flibusta.is/');
const flibustaApi = new FlibustaAPI();

const searchAuthorsResult = await flibustaApi.getAuthors(authorName);

Expand Down
4 changes: 2 additions & 2 deletions examples/searchAuthorsPaginated.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, authorName, pageNumber, itemsLimit] = process.argv;
const flibustaApi = new FlibustaAPI('http://flibusta.is/');
const flibustaApi = new FlibustaAPI();

const itemsLimitAsInt = Number.parseInt(itemsLimit ?? 50, 10);
const pageNumberAsInt = Number.parseInt(pageNumber ?? 0, 10);
Expand Down
8 changes: 4 additions & 4 deletions examples/searchBooksByName.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, authorName] = process.argv;
const flibustaApi = new FlibustaAPI('http://flibusta.is/');
const [/* original value */, /* path to the file */, bookName] = process.argv;
const flibustaApi = new FlibustaAPI();

const searchBooksByNameResult = await flibustaApi.getBooksByName(authorName);
const searchBooksByNameResult = await flibustaApi.getBooksByName(bookName);

console.log(JSON.stringify(searchBooksByNameResult, undefined, 2));
})();
6 changes: 3 additions & 3 deletions examples/searchBooksByNameFromOpds.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, authorName] = process.argv;
const [/* original value */, /* path to the file */, bookName] = process.argv;
const flibustaApi = new FlibustaAPI();

const searchBooksByNameResult = await flibustaApi.getBooksByNameFromOpds(authorName);
const searchBooksByNameResult = await flibustaApi.getBooksByNameFromOpds(bookName);

console.log(JSON.stringify(searchBooksByNameResult, undefined, 2));
})();
6 changes: 3 additions & 3 deletions examples/searchBooksByNameFromOpdsPaginated.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, authorName, pageNumber, itemsLimit] = process.argv;
const [/* original value */, /* path to the file */, bookName, pageNumber, itemsLimit] = process.argv;
const flibustaApi = new FlibustaAPI();

const itemsLimitAsInt = Number.parseInt(itemsLimit ?? 20, 10);
const pageNumberAsInt = Number.parseInt(pageNumber ?? 0, 10);

const searchBooksByNameResult = await flibustaApi.getBooksByNameFromOpdsPaginated(
authorName,
bookName,
pageNumberAsInt,
itemsLimitAsInt,
);
Expand Down
4 changes: 2 additions & 2 deletions examples/searchBooksByNamePaginated.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, bookName, pageNumber, itemsLimit] = process.argv;
const flibustaApi = new FlibustaAPI('http://flibusta.is/');
const flibustaApi = new FlibustaAPI();

const itemsLimitAsInt = Number.parseInt(itemsLimit ?? 50, 10);
const pageNumberAsInt = Number.parseInt(pageNumber ?? 0, 10);
Expand Down
8 changes: 4 additions & 4 deletions examples/searchBooksBySeries.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, authorName] = process.argv;
const flibustaApi = new FlibustaAPI('http://flibusta.is/');
const [/* original value */, /* path to the file */, seriesName] = process.argv;
const flibustaApi = new FlibustaAPI();

const searchBooksBySeriesResult = await flibustaApi.getBooksBySeries(authorName);
const searchBooksBySeriesResult = await flibustaApi.getBooksBySeries(seriesName);

console.log(JSON.stringify(searchBooksBySeriesResult, undefined, 2));
})();
4 changes: 2 additions & 2 deletions examples/searchBooksBySeriesPaginated.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import FlibustaAPI from '../src/index';
import FlibustaAPI from '@src/index';

(async () => {
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [/* original value */, /* path to the file */, seriesName, pageNumber, itemsLimit] = process.argv;
const flibustaApi = new FlibustaAPI('http://flibusta.is/');
const flibustaApi = new FlibustaAPI();

const itemsLimitAsInt = Number.parseInt(itemsLimit ?? 50, 10);
const pageNumberAsInt = Number.parseInt(pageNumber ?? 0, 10);
Expand Down

0 comments on commit db232d1

Please sign in to comment.