Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 12, 2024
1 parent f48890c commit 856a979
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $ npm install tesla-specifications --save

## Usage

The data is based in Tesla official numbers taking into the chasis and the wheel size:
The data is based in Tesla official numbers taking into the chassis and the wheel size:

```js
const teslaSpecs = require('tesla-specifications')
Expand Down
10 changes: 5 additions & 5 deletions scripts/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ const processResults = results => {
data.group.startsWith('SPEC')
)
const wheels = getWheels(OptionCodeData)
const chasis = specData[0].code.slice(1)
const chassis = specData[0].code.slice(1)

const spec = {
acceleration: getSpec('SPECS_ACCELERATION', specData),
topSpeed: getSpec('SPECS_TOP_SPEED', specData),
rangeWLTP: rangeWLTP('SPECS_RANGE', specData)
}

if (DATA[chasis] === undefined) DATA[chasis] = {}
if (DATA[chasis][wheels]) continue
if (DATA[chassis] === undefined) DATA[chassis] = {}
if (DATA[chassis][wheels]) continue

const updateSpec = spec => {
spec.acceleration = unitSpace(spec.acceleration)
spec.topSpeed = unitSpace(spec.topSpeed)
spec.rangeWLTP = unitSpace(spec.rangeWLTP)
DATA[chasis][wheels] = spec
DATA[chassis][wheels] = spec
}

if (spec.topSpeed.includes('km/h') && spec.acceleration.endsWith('s')) {
Expand All @@ -88,7 +88,7 @@ const processResults = results => {
rangeWLTP: `${milesToKm(parseNum(spec.rangeWLTP))}km`
})
} else {
debug('skipped', { vin, chasis }, spec)
debug('skipped', { vin, chassis }, spec)
continue
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const EXTRA = {
}

module.exports = ({ optionCodes, modelLetter }) => {
const chasis = optionCodes.find(code => code.startsWith(`MT${modelLetter}`))
if (!chasis) return
const specs = teslaSpecs[chasis]
const chassis = optionCodes.find(code => code.startsWith(`MT${modelLetter}`))
if (!chassis) return
const specs = teslaSpecs[chassis]
return {
...specs[Object.keys(specs)[0]],
...EXTRA[modelLetter]
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const test = require('ava')

const teslaSpecs = require('../')

test("return undefined if chasis doesn't exist", t => {
test("return undefined if chassis doesn't exist", t => {
const specs = teslaSpecs({ optionCodes: ['MT303'], modelLetter: 'T' })
t.is(specs, undefined)
})
Expand Down

0 comments on commit 856a979

Please sign in to comment.