This repository was archived by the owner on Feb 20, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ import debounce from './debounce'
74
74
import curry from './curry'
75
75
import textJustification from './textJustification'
76
76
import removeProperty from './removeProperty'
77
+ import temperatureConverter from './temperatureConverter'
77
78
78
79
export {
79
80
reverseArrayInPlace ,
@@ -152,4 +153,5 @@ export {
152
153
textJustification ,
153
154
removeProperty ,
154
155
dec2hex ,
156
+ temperatureConverter ,
155
157
}
Original file line number Diff line number Diff line change
1
+ export default temperatureConverter
2
+ /**
3
+ * Original Source: https://stackoverflow.com/questions/15122347/
4
+ *
5
+ * This function gets temperature in fahrenheit and converts it into celsius
6
+ *
7
+ * @param {Number } fahrenheit - Temperature in fahrenheit
8
+ * @return {Number } - Temperature in celsius
9
+ */
10
+ function temperatureConverter ( fahrenheit ) {
11
+ const celsius = ( fahrenheit - 32 ) * 5 / 9
12
+ return celsius
13
+ }
Original file line number Diff line number Diff line change
1
+ import test from 'ava'
2
+ import { temperatureConverter } from '../src'
3
+
4
+ test ( 'converts temperature' , t => {
5
+ const number = 78
6
+ const expected = ( number - 32 ) * 5 / 9
7
+ const actual = temperatureConverter ( number )
8
+ t . is ( actual , expected )
9
+
10
+ } )
You can’t perform that action at this time.
0 commit comments