Skip to content

Commit 70d37db

Browse files
committed
gitignore updated | return statement removed from function
1 parent 0841763 commit 70d37db

File tree

6 files changed

+6
-8
lines changed

6 files changed

+6
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
dist
3+
junk

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src

src/scraper/constructors-standings.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getConstructorStandings = (year: number = new Date().getFullYear())
2626
const team: string = $(this).find('td:nth-child(3)').text().trim()
2727
const points: number = parseInt($(this).find('td:nth-child(4)').text().trim())
2828

29-
if (position !== NaN && team.length !== 0 && points !== NaN) {
29+
if (!Number.isNaN(position) && team.length !== 0 && !Number.isNaN(points)) {
3030
const constructorStanding: constructorStanding = {
3131
position,
3232
team,
@@ -36,7 +36,6 @@ export const getConstructorStandings = (year: number = new Date().getFullYear())
3636
}
3737
})
3838
resolve(constructorStandings)
39-
return Promise.all(constructorStandings)
4039
})
4140
.catch(err => { reject(err) })
4241
})

src/scraper/driver-data.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const getDriverData = (): Promise<drivers[]> => {
3232
const nationalityImage: string | undefined = $(this).find('.container > .row.justify-content-between.align-items-center.listing-item--head > .col-xs-4.country-flag > picture:nth-child(1) > img:nth-child(2)').attr('data-src')
3333
const driverImage: string | undefined = $(this).find(' div:nth-child(4) > picture:nth-child(1) > img:nth-child(2)').attr('data-src')
3434

35-
if (firstName.length !== 0 && secondName.length !== 0 && team.length !== 0 && rank !== NaN && points !== NaN) {
35+
if (firstName.length !== 0 && secondName.length !== 0 && team.length !== 0 && !Number.isNaN(rank) && !Number.isNaN(points)) {
3636
const driver: drivers = {
3737
name: firstName.concat(" ", secondName),
3838
team,
@@ -45,7 +45,6 @@ export const getDriverData = (): Promise<drivers[]> => {
4545
}
4646
})
4747
resolve(drivers)
48-
return Promise.all(drivers)
4948
})
5049
.catch(err => { reject(err) })
5150
})

src/scraper/driver-standings.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const getDriverStandings = (year: number = new Date().getFullYear()): Pro
3434
const team: string = $(this).find('td:nth-child(5) > a.grey.semi-bold.uppercase.ArchiveLink').text()
3535
const points: number = parseInt($(this).find(' td:nth-child(6) ').text())
3636

37-
if (position !== NaN && points !== NaN && driver.length !== 0 && nationality.length !== 0 && team.length !== 0) {
37+
if (!Number.isNaN(position) && !Number.isNaN(points) && driver.length !== 0 && nationality.length !== 0 && team.length !== 0) {
3838
const driverStanding: driverStanding = {
3939
position,
4040
driver,
@@ -46,7 +46,6 @@ export const getDriverStandings = (year: number = new Date().getFullYear()): Pro
4646
}
4747
})
4848
resolve(driverStandings)
49-
return Promise.all(driverStandings)
5049
})
5150
.catch(err => { reject(err) })
5251
})

src/scraper/team-data.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const getTeamsData = (): Promise<teams[]> => {
3939
const carLogo: string | undefined = $(this).find('div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > picture:nth-child(1) > img:nth-child(2)').attr('data-src')
4040
const carImage: string | undefined = $(this).find('div:nth-child(1) > div:nth-child(4) > picture:nth-child(1) > img:nth-child(5)').attr('data-src')
4141

42-
if (name.length !== 0 && points !== NaN && rank !== NaN) {
42+
if (name.length !== 0 && !Number.isNaN(points) && !Number.isNaN(rank)) {
4343
const team: teams = {
4444
name,
4545
drivers,
@@ -52,7 +52,6 @@ export const getTeamsData = (): Promise<teams[]> => {
5252
}
5353
})
5454
resolve(teams)
55-
return Promise.all(teams)
5655
})
5756
.catch(err => { reject(err) })
5857
})

0 commit comments

Comments
 (0)