vehicle/classification.js

/**
 * Anything to help working out aspects of a vehicle

 * @module
 */

/**
 * work out whether its a plugin hybrid
 * @param {number} mpg
 * @param {number} battery_range_miles
 * @returns {number}
 */
const isPHEV = (mpg, battery_range_miles) => {
    // throw error if both mpg and battery_range_miles are 0
    if (mpg === '' && battery_range_miles === '') {
        throw new Error('Both mpg and battery range miles cannot be empty');
    }
    return mpg > 0 && battery_range_miles > 0;
};

export {
    isPHEV,
};