Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cc0700f

Browse files
conversion: liters to imperial gallons (TheAlgorithms#1256)
* Added liters to imperial gallons conversion * Fixed documentation @see * Pr suggestion
1 parent 863185d commit cc0700f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* This function converts liters to imperial gallons
3+
* @constructor
4+
* @param {number} liters - Amount of liters to convert to gallons
5+
* @see https://en.wikipedia.org/wiki/Gallon
6+
*/
7+
const litersToImperialGallons = (liters) => {
8+
return liters / 4.54609
9+
}
10+
11+
export default litersToImperialGallons
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import litersToImperialGallons from '../LitersToImperialGallons'
2+
3+
test('Convert 25 liters to imperial gallons', () => {
4+
expect(parseFloat(litersToImperialGallons(25).toFixed(2))).toBe(5.5)
5+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /