Skip to content

Commit

Permalink
Updating statement in condition for returning first array element.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steppico committed Nov 24, 2021
1 parent 6c4731a commit 9269411
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions loaders/getArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ function getRandom(type, number) {

function getArticle(type, id) {
if (type == 'quotes') {
if (id < 0) {
return quotes[1]
if (id <= 0) {
return quotes[0]
}
else if (id > quotes.length) {
return quotes[quotes.length - 1]
Expand All @@ -94,8 +94,8 @@ function getArticle(type, id) {
}
}
else if (type == 'books') {
if (id < 0) {
return books[1]
if (id <= 0) {
return books[0]
}
else if (id > books.length) {
return books[books.length - 1]
Expand All @@ -105,8 +105,8 @@ function getArticle(type, id) {
}
}
else if (type == 'movies') {
if (id < 0) {
return movies[1]
if (id <= 0) {
return movies[0]
}
else if (id > movies.length) {
return movies[movies.length - 1]
Expand All @@ -116,8 +116,8 @@ function getArticle(type, id) {
}
}
else if (type == 'series') {
if (id < 0) {
return series[1]
if (id <= 0) {
return series[0]
}
else if (id > series.length) {
return series[series.length - 1]
Expand All @@ -127,8 +127,8 @@ function getArticle(type, id) {
}
}
else if (type == 'stories') {
if (id < 0) {
return shortStories[1]
if (id <= 0) {
return shortStories[0]
}
else if (id > stories.length) {
return shortStories[shortStories.length - 1]
Expand All @@ -138,8 +138,8 @@ function getArticle(type, id) {
}
}
else if (type == 'comics') {
if (id < 0) {
return comics[1]
if (id <= 0) {
return comics[0]
}
else if (id > comics.length) {
return comics[comics.length - 1]
Expand Down

0 comments on commit 9269411

Please sign in to comment.