aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/converter.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/modern/src/common/converter.js b/modern/src/common/converter.js
new file mode 100644
index 00000000..e48b0760
--- /dev/null
+++ b/modern/src/common/converter.js
@@ -0,0 +1,13 @@
+export const speedConverter = (value, unit) => {
+ let factor;
+ switch (unit) {
+ case 'kmh':
+ factor = 1.852;
+ case 'mph':
+ factor = 1.15078;
+ case 'kn':
+ default:
+ factor = 1;
+ }
+ return (value * factor).toFixed(2);
+};