Update measurement.js

This commit is contained in:
BennyDaBee 2022-08-15 14:15:30 -05:00 committed by GitHub
parent 2e5f9621f8
commit fdba453f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ class Measurement {
'°C', '°C',
'km', 'km',
'kPa', 'kPa',
'km/l(e)', 'km/l',
// Helps with conversion to Gallons. // Helps with conversion to Gallons.
'lit' 'lit'
]; ];
@ -32,12 +32,12 @@ class Measurement {
return 'km'; return 'km';
case 'KPa': case 'KPa':
return 'kPa'; return 'kPa';
case 'kmple': case 'kmpl':
return 'km/l(e)'; return 'km/l';
case 'volts': case 'volts':
case 'Volts': case 'Volts':
return 'V'; return 'V';
case 'l': case 'L':
return 'lit'; return 'lit';
// these are states // these are states
case 'Stat': case 'Stat':
@ -66,7 +66,7 @@ class Measurement {
case 'kPa': case 'kPa':
value = _.round(convert(value).from('kPa').to('psi'), 1); value = _.round(convert(value).from('kPa').to('psi'), 1);
break; break;
case 'km/l(e)': case 'km/l':
// km/L = (1.609344 / 3.785411784) * MPG // km/L = (1.609344 / 3.785411784) * MPG
value = _.round(value / (1.609344 / 3.785411784), 1); value = _.round(value / (1.609344 / 3.785411784), 1);
break; break;
@ -90,8 +90,8 @@ class Measurement {
return 'mi'; return 'mi';
case 'kPa': case 'kPa':
return 'psi'; return 'psi';
case 'km/l(e)': case 'km/l':
return 'mpg(e)'; return 'mpg';
case 'lit': case 'lit':
return 'gal'; return 'gal';
default: default: