Skip to content

Commit

Permalink
Update units.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Soham-Thodge authored Oct 23, 2023
1 parent 87d7e36 commit b398a64
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions adv-math/src/units-conversions/units.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ class Units {
throw new Error("Invalid weight unit conversion.");
}
}
static convertVolume(value, fromUnit, toUnit) {
if (fromUnit === "litres" && toUnit === "fluidOZ") {
return value * 33.814;
} else if (fromUnit === "fluidOZ" && toUnit === "litres") {
return value * 0.0295735;
} else {
throw new Error("Invalid volume unit conversion.");
}
}
}

module.exports = Units;

0 comments on commit b398a64

Please sign in to comment.