Skip to content

Commit

Permalink
refactor: remove reduntant photos
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 18, 2024
1 parent 8249c21 commit 8ee2c20
Show file tree
Hide file tree
Showing 26 changed files with 26 additions and 65 deletions.
Binary file modified images/3/3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/3/5.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/S/1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/S/2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/S/3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/S/4.jpeg
Binary file not shown.
Binary file removed images/S/5.jpeg
Binary file not shown.
Binary file removed images/S/6.jpeg
Binary file not shown.
Binary file removed images/S/7.jpeg
Binary file not shown.
Binary file modified images/X/1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/X/2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/X/3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/X/4.jpeg
Binary file not shown.
Binary file removed images/X/5.jpeg
Binary file not shown.
Binary file removed images/X/6.jpeg
Binary file not shown.
Binary file modified images/Y/1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Y/2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Y/3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Y/4.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Y/5.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = vin => {
bodyType: require('./body-type')[modelLetter](digit(vin, 5), year),
model: require('./model')(modelLetter),
motor: require('./motor')[modelLetter](digit(vin, 8), year),
photos: require('./photos')[modelLetter](year),
photos: require('./photos')[modelLetter],
plantOfManufacture: require('./plan-of-manufacture')(digit(vin, 11)),
restraintSystems: require('./restraint-systems')[modelLetter](digit(vin, 6), year),
sequenceNumber: require('./sequence-number')(digit(vin, 12, 17)),
Expand Down
69 changes: 16 additions & 53 deletions src/photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,24 @@

const BASE_URL = 'https://teslahunt.github.io/tesla-vin/images'

const S = year => {
switch (year) {
case 2012:
case 2013:
case 2014:
case 2015:
return [`${BASE_URL}/S/1.jpeg`, `${BASE_URL}/S/2.jpeg`, `${BASE_URL}/S/3.jpeg`]
case 2016:
case 2017:
case 2018:
case 2019:
case 2020:
return [
`${BASE_URL}/S/1.jpeg`,
`${BASE_URL}/S/2.jpeg`,
`${BASE_URL}/S/3.jpeg`,
`${BASE_URL}/S/4.jpeg`
]
default:
return [`${BASE_URL}/S/5.jpeg`, `${BASE_URL}/S/6.jpeg`, `${BASE_URL}/S/7.jpeg`]
}
}
const S = [`${BASE_URL}/S/1.jpeg`, `${BASE_URL}/S/2.jpeg`, `${BASE_URL}/S/3.jpeg`]

const X = year => {
switch (year) {
case 2015:
case 2016:
case 2017:
case 2018:
case 2019:
case 2020:
return [`${BASE_URL}/X/1.jpeg`, `${BASE_URL}/X/2.jpeg`, `${BASE_URL}/X/3.jpeg`]
default:
return [`${BASE_URL}/X/4.jpeg`, `${BASE_URL}/X/5.jpeg`, `${BASE_URL}/X/6.jpeg`]
}
}
const X = [`${BASE_URL}/X/1.jpeg`, `${BASE_URL}/X/2.jpeg`, `${BASE_URL}/X/3.jpeg`]

const Y = () => {
return [
`${BASE_URL}/Y/1.jpeg`,
`${BASE_URL}/Y/2.jpeg`,
`${BASE_URL}/Y/3.jpeg`,
`${BASE_URL}/Y/4.jpeg`,
`${BASE_URL}/Y/5.jpeg`
]
}
const Y = [
`${BASE_URL}/Y/1.jpeg`,
`${BASE_URL}/Y/2.jpeg`,
`${BASE_URL}/Y/3.jpeg`,
`${BASE_URL}/Y/4.jpeg`,
`${BASE_URL}/Y/5.jpeg`
]

const _3 = () => {
return [
`${BASE_URL}/3/1.jpeg`,
`${BASE_URL}/3/2.jpeg`,
`${BASE_URL}/3/3.jpeg`,
`${BASE_URL}/3/4.jpeg`,
`${BASE_URL}/3/5.jpeg`
]
}
const _3 = [
`${BASE_URL}/3/1.jpeg`,
`${BASE_URL}/3/2.jpeg`,
`${BASE_URL}/3/3.jpeg`,
`${BASE_URL}/3/4.jpeg`,
`${BASE_URL}/3/5.jpeg`
]

module.exports = { S, 3: _3, X, Y }
14 changes: 6 additions & 8 deletions test/snapshots/model-s.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ Generated by [AVA](https://avajs.dev).
'https://teslahunt.github.io/tesla-vin/images/S/1.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/2.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/3.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/4.jpeg',
],
plantOfManufacture: 'Tesla Fremont, California (USA)',
restraintSystems: 'Type 2 manual seatbelts (FR, SR*3) with front airbags, side inflatable restraints & active hood',
Expand All @@ -138,7 +137,6 @@ Generated by [AVA](https://avajs.dev).
'https://teslahunt.github.io/tesla-vin/images/S/1.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/2.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/3.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/4.jpeg',
],
plantOfManufacture: 'Tesla Fremont, California (USA)',
restraintSystems: 'Type 2 manual seatbelts (FR, SR*3) with front airbags, side inflatable restraints',
Expand All @@ -160,9 +158,9 @@ Generated by [AVA](https://avajs.dev).
model: 'Tesla Model S',
motor: 'Triple Motor',
photos: [
'https://teslahunt.github.io/tesla-vin/images/S/5.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/6.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/7.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/1.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/2.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/3.jpeg',
],
plantOfManufacture: 'Tesla Fremont, California (USA)',
restraintSystems: 'Type 2 Manual seat belts (FR, SR*3) with front Airbags, PODS, side Inflatable restraints, Knee Airbags',
Expand All @@ -184,9 +182,9 @@ Generated by [AVA](https://avajs.dev).
model: 'Tesla Model S',
motor: null,
photos: [
'https://teslahunt.github.io/tesla-vin/images/S/5.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/6.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/7.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/1.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/2.jpeg',
'https://teslahunt.github.io/tesla-vin/images/S/3.jpeg',
],
plantOfManufacture: null,
restraintSystems: null,
Expand Down
Binary file modified test/snapshots/model-s.js.snap
Binary file not shown.
6 changes: 3 additions & 3 deletions test/snapshots/model-x.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ Generated by [AVA](https://avajs.dev).
model: 'Tesla Model X',
motor: 'Triple Motor',
photos: [
'https://teslahunt.github.io/tesla-vin/images/X/4.jpeg',
'https://teslahunt.github.io/tesla-vin/images/X/5.jpeg',
'https://teslahunt.github.io/tesla-vin/images/X/6.jpeg',
'https://teslahunt.github.io/tesla-vin/images/X/1.jpeg',
'https://teslahunt.github.io/tesla-vin/images/X/2.jpeg',
'https://teslahunt.github.io/tesla-vin/images/X/3.jpeg',
],
plantOfManufacture: 'Tesla Fremont, California (USA)',
restraintSystems: 'Type 2 Manual seatbelts with front Airbags, PODS, side Inflatable restraints',
Expand Down
Binary file modified test/snapshots/model-x.js.snap
Binary file not shown.

0 comments on commit 8ee2c20

Please sign in to comment.