Skip to content

Commit c61e17d

Browse files
committed
rebase: ts to js and add undefiend check
1 parent 97ec2a2 commit c61e17d

File tree

4 files changed

+6
-124
lines changed

4 files changed

+6
-124
lines changed

src/index.ts renamed to index.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
const axios = require('axios').default
22

33
class Book {
4-
id: string
5-
title: string
6-
authors: string[]
7-
description: string
8-
publisher: string
9-
publishedDate: Date
10-
thumbnailURL: string
11-
totalItems: number
12-
13-
constructor (id: string, title: string, authors: string[], description: string, publisher: string, publishedDate: Date, thumbnailURL: string, totalItems: number) {
4+
constructor (id, title, authors, description, publisher, publishedDate, thumbnailURL, totalItems) {
145
this.id = id
156
this.title = title
167
this.authors = authors
@@ -22,12 +13,12 @@ class Book {
2213
}
2314
}
2415

25-
export async function getBook (name: string) {
16+
export async function getBook (name) {
2617
const url = 'https://www.googleapis.com/books/v1/volumes'
2718
const params = { q: name, maxResults: 1 }
2819

2920
const res = await axios.get(url, { params })
30-
if (res.data.items.length === 0) {
21+
if (res.data.items === undefined) {
3122
return 1
3223
}
3324
const data = res.data.items[0]

package.json

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "instaplot",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "A module to get information about books",
5-
"main": "build/index.js",
5+
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"build-dist": "./node_modules/typescript/bin/tsc",
@@ -11,14 +11,9 @@
1111
"author": "Vaibhav Dhiman",
1212
"license": "GPL-3.0-or-later",
1313
"dependencies": {
14-
"axios": "^0.27.2",
15-
"source-map-support": "^0.5.21",
16-
"typescript": "^4.7.3"
14+
"axios": "^0.27.2"
1715
},
1816
"devDependencies": {
19-
"@types/node": "^17.0.42",
20-
"@typescript-eslint/eslint-plugin": "^5.28.0",
21-
"@typescript-eslint/parser": "^5.28.0",
2217
"eslint": "^8.17.0",
2318
"eslint-config-standard": "^17.0.0",
2419
"eslint-plugin-import": "^2.26.0",

src/index.d.ts

-1
This file was deleted.

tsconfig.json

-103
This file was deleted.

0 commit comments

Comments
 (0)