From a9a61b4de2935754028e167e198a8e952c8180db Mon Sep 17 00:00:00 2001 From: Quentin Oschatz Date: Fri, 12 Oct 2018 21:49:43 +0200 Subject: [PATCH 1/3] Add Kilometers/Hour to Miles/Hour conversion and reverse --- snippets/kphToMph.md | 14 ++++++++++++++ snippets/mphToKph.md | 14 ++++++++++++++ tag_database | 2 ++ test/kphToMph/kphToMph.js | 2 ++ test/kphToMph/kphToMph.test.js | 12 ++++++++++++ test/mphToKph/mphToKph.js | 2 ++ test/mphToKph/mphToKph.test.js | 12 ++++++++++++ 7 files changed, 58 insertions(+) create mode 100644 snippets/kphToMph.md create mode 100644 snippets/mphToKph.md create mode 100644 test/kphToMph/kphToMph.js create mode 100644 test/kphToMph/kphToMph.test.js create mode 100644 test/mphToKph/mphToKph.js create mode 100644 test/mphToKph/mphToKph.test.js diff --git a/snippets/kphToMph.md b/snippets/kphToMph.md new file mode 100644 index 000000000..ae260c7f4 --- /dev/null +++ b/snippets/kphToMph.md @@ -0,0 +1,14 @@ +### kphToMph + +Convert kilometers/hour to miles/hour. + +Multiply the constant of proportionality with the argument. + +```js +const kphToMph = (kph) => 0.621371192 * kph; +``` + +```js +kphToMph(10); //16.09344000614692 +kphToMph(345.4); //138.24264965280207 +``` diff --git a/snippets/mphToKph.md b/snippets/mphToKph.md new file mode 100644 index 000000000..9854cd977 --- /dev/null +++ b/snippets/mphToKph.md @@ -0,0 +1,14 @@ +### mphToKph + +Convert miles/hour to kilometers/hour. + +Multiply the constant of proportionality with the argument. + +```js +const mphToKph = (mph) => 1.6093440006146922 * mph; +``` + +```js +mphToKph(10); //16.09344000614692 +mphToKph(85.9); //138.24264965280207 +``` diff --git a/tag_database b/tag_database index cd05988b1..d98a9dc7a 100644 --- a/tag_database +++ b/tag_database @@ -168,6 +168,7 @@ isWritableStream:node,type,intermediate join:array,intermediate JSONtoCSV:array,string,object,advanced JSONToFile:node,json,intermediate +kphToMph:utility,beginner last:array,beginner lcm:math,recursion,beginner longestItem:array,string,utility,intermediate @@ -190,6 +191,7 @@ minBy:math,array,function,beginner minDate:date,math,beginner minN:array,math,beginner mostPerformant:utility,function +mphToKph:utility,beginner negate:function,beginner nest:object,intermediate nodeListToArray:browser,array,beginner diff --git a/test/kphToMph/kphToMph.js b/test/kphToMph/kphToMph.js new file mode 100644 index 000000000..c6eb3df7b --- /dev/null +++ b/test/kphToMph/kphToMph.js @@ -0,0 +1,2 @@ +const kphToMph = (kph) => 0.621371192 * kph; +module.exports = kphToMph; diff --git a/test/kphToMph/kphToMph.test.js b/test/kphToMph/kphToMph.test.js new file mode 100644 index 000000000..846957c90 --- /dev/null +++ b/test/kphToMph/kphToMph.test.js @@ -0,0 +1,12 @@ +const expect = require('expect'); +const kphToMph = require('./kphToMph.js'); + +test('kphToMph is a Function', () => { + expect(kphToMph).toBeInstanceOf(Function); +}); +test('Returns mph from kph.', () => { + expect(kphToMph(10)).toBe(6.21371192); +}); +test('Returns mph from kph.', () => { + expect(kphToMph(345.4)).toBe(214.62160971679998); +}); diff --git a/test/mphToKph/mphToKph.js b/test/mphToKph/mphToKph.js new file mode 100644 index 000000000..2322f4284 --- /dev/null +++ b/test/mphToKph/mphToKph.js @@ -0,0 +1,2 @@ +const mphToKph = (mph) => 1.6093440006146922 * mph; +module.exports = mphToKph; diff --git a/test/mphToKph/mphToKph.test.js b/test/mphToKph/mphToKph.test.js new file mode 100644 index 000000000..1d9ff3938 --- /dev/null +++ b/test/mphToKph/mphToKph.test.js @@ -0,0 +1,12 @@ +const expect = require('expect'); +const mphToKph = require('./mphToKph.js'); + +test('mphToKph is a Function', () => { + expect(mphToKph).toBeInstanceOf(Function); +}); +test('Returns kph from mph.', () => { + expect(mphToKph(10)).toBe(16.09344000614692); +}); +test('Returns kph from mph.', () => { + expect(mphToKph(85.9)).toBe(138.24264965280207); +}); From 26afaf454cc33a292ef64cfa4d73b5a6bce465dd Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 16 Oct 2018 20:22:23 +0300 Subject: [PATCH 2/3] Archived --- snippets/kphToMph.md | 14 -------------- snippets/mphToKph.md | 14 -------------- snippets_archive/kmphToMph.md | 14 ++++++++++++++ snippets_archive/mphToKmph.md | 14 ++++++++++++++ tag_database | 2 -- test/kmphToMph/kphToMph.js | 2 ++ test/kmphToMph/kphToMph.test.js | 9 +++++++++ test/kphToMph/kphToMph.js | 2 -- test/kphToMph/kphToMph.test.js | 12 ------------ test/mphToKmph/mphToKmph.js | 2 ++ test/mphToKmph/mphToKmph.test.js | 9 +++++++++ test/mphToKph/mphToKph.js | 2 -- test/mphToKph/mphToKph.test.js | 12 ------------ 13 files changed, 50 insertions(+), 58 deletions(-) delete mode 100644 snippets/kphToMph.md delete mode 100644 snippets/mphToKph.md create mode 100644 snippets_archive/kmphToMph.md create mode 100644 snippets_archive/mphToKmph.md create mode 100644 test/kmphToMph/kphToMph.js create mode 100644 test/kmphToMph/kphToMph.test.js delete mode 100644 test/kphToMph/kphToMph.js delete mode 100644 test/kphToMph/kphToMph.test.js create mode 100644 test/mphToKmph/mphToKmph.js create mode 100644 test/mphToKmph/mphToKmph.test.js delete mode 100644 test/mphToKph/mphToKph.js delete mode 100644 test/mphToKph/mphToKph.test.js diff --git a/snippets/kphToMph.md b/snippets/kphToMph.md deleted file mode 100644 index ae260c7f4..000000000 --- a/snippets/kphToMph.md +++ /dev/null @@ -1,14 +0,0 @@ -### kphToMph - -Convert kilometers/hour to miles/hour. - -Multiply the constant of proportionality with the argument. - -```js -const kphToMph = (kph) => 0.621371192 * kph; -``` - -```js -kphToMph(10); //16.09344000614692 -kphToMph(345.4); //138.24264965280207 -``` diff --git a/snippets/mphToKph.md b/snippets/mphToKph.md deleted file mode 100644 index 9854cd977..000000000 --- a/snippets/mphToKph.md +++ /dev/null @@ -1,14 +0,0 @@ -### mphToKph - -Convert miles/hour to kilometers/hour. - -Multiply the constant of proportionality with the argument. - -```js -const mphToKph = (mph) => 1.6093440006146922 * mph; -``` - -```js -mphToKph(10); //16.09344000614692 -mphToKph(85.9); //138.24264965280207 -``` diff --git a/snippets_archive/kmphToMph.md b/snippets_archive/kmphToMph.md new file mode 100644 index 000000000..14422bb15 --- /dev/null +++ b/snippets_archive/kmphToMph.md @@ -0,0 +1,14 @@ +### kmphToMph + +Convert kilometers/hour to miles/hour. + +Multiply the constant of proportionality with the argument. + +```js +const kmphToMph = (kmph) => 0.621371192 * kmph; +``` + +```js +kmphToMph(10); // 16.09344000614692 +kmphToMph(345.4); // 138.24264965280207 +``` diff --git a/snippets_archive/mphToKmph.md b/snippets_archive/mphToKmph.md new file mode 100644 index 000000000..4d898709e --- /dev/null +++ b/snippets_archive/mphToKmph.md @@ -0,0 +1,14 @@ +### mphToKmph + +Convert miles/hour to kilometers/hour. + +Multiply the constant of proportionality with the argument. + +```js +const mphToKmph = (mph) => 1.6093440006146922 * mph; +``` + +```js +mphToKmph(10); // 16.09344000614692 +mphToKmph(85.9); // 138.24264965280207 +``` diff --git a/tag_database b/tag_database index d98a9dc7a..cd05988b1 100644 --- a/tag_database +++ b/tag_database @@ -168,7 +168,6 @@ isWritableStream:node,type,intermediate join:array,intermediate JSONtoCSV:array,string,object,advanced JSONToFile:node,json,intermediate -kphToMph:utility,beginner last:array,beginner lcm:math,recursion,beginner longestItem:array,string,utility,intermediate @@ -191,7 +190,6 @@ minBy:math,array,function,beginner minDate:date,math,beginner minN:array,math,beginner mostPerformant:utility,function -mphToKph:utility,beginner negate:function,beginner nest:object,intermediate nodeListToArray:browser,array,beginner diff --git a/test/kmphToMph/kphToMph.js b/test/kmphToMph/kphToMph.js new file mode 100644 index 000000000..7dc23ac31 --- /dev/null +++ b/test/kmphToMph/kphToMph.js @@ -0,0 +1,2 @@ +const kmphToMph = (kmph) => 0.621371192 * kmph; +module.exports = kmphToMph; diff --git a/test/kmphToMph/kphToMph.test.js b/test/kmphToMph/kphToMph.test.js new file mode 100644 index 000000000..23923c287 --- /dev/null +++ b/test/kmphToMph/kphToMph.test.js @@ -0,0 +1,9 @@ +const expect = require('expect'); +const kmphToMph = require('./kmphToMph.js'); + +test('kmphToMph is a Function', () => { + expect(kmphToMph).toBeInstanceOf(Function); +}); +test('Returns mph from kph.', () => { + expect(kmphToMph(10)).toBe(6.21371192); +}); diff --git a/test/kphToMph/kphToMph.js b/test/kphToMph/kphToMph.js deleted file mode 100644 index c6eb3df7b..000000000 --- a/test/kphToMph/kphToMph.js +++ /dev/null @@ -1,2 +0,0 @@ -const kphToMph = (kph) => 0.621371192 * kph; -module.exports = kphToMph; diff --git a/test/kphToMph/kphToMph.test.js b/test/kphToMph/kphToMph.test.js deleted file mode 100644 index 846957c90..000000000 --- a/test/kphToMph/kphToMph.test.js +++ /dev/null @@ -1,12 +0,0 @@ -const expect = require('expect'); -const kphToMph = require('./kphToMph.js'); - -test('kphToMph is a Function', () => { - expect(kphToMph).toBeInstanceOf(Function); -}); -test('Returns mph from kph.', () => { - expect(kphToMph(10)).toBe(6.21371192); -}); -test('Returns mph from kph.', () => { - expect(kphToMph(345.4)).toBe(214.62160971679998); -}); diff --git a/test/mphToKmph/mphToKmph.js b/test/mphToKmph/mphToKmph.js new file mode 100644 index 000000000..d4190a376 --- /dev/null +++ b/test/mphToKmph/mphToKmph.js @@ -0,0 +1,2 @@ +const mphToKmph = (mph) => 1.6093440006146922 * mph; +module.exports = mphToKmph; diff --git a/test/mphToKmph/mphToKmph.test.js b/test/mphToKmph/mphToKmph.test.js new file mode 100644 index 000000000..f5a229623 --- /dev/null +++ b/test/mphToKmph/mphToKmph.test.js @@ -0,0 +1,9 @@ +const expect = require('expect'); +const mphToKmph = require('./mphToKmph.js'); + +test('mphToKmph is a Function', () => { + expect(mphToKmph).toBeInstanceOf(Function); +}); +test('Returns kph from mph.', () => { + expect(mphToKmph(10)).toBe(16.09344000614692); +}); diff --git a/test/mphToKph/mphToKph.js b/test/mphToKph/mphToKph.js deleted file mode 100644 index 2322f4284..000000000 --- a/test/mphToKph/mphToKph.js +++ /dev/null @@ -1,2 +0,0 @@ -const mphToKph = (mph) => 1.6093440006146922 * mph; -module.exports = mphToKph; diff --git a/test/mphToKph/mphToKph.test.js b/test/mphToKph/mphToKph.test.js deleted file mode 100644 index 1d9ff3938..000000000 --- a/test/mphToKph/mphToKph.test.js +++ /dev/null @@ -1,12 +0,0 @@ -const expect = require('expect'); -const mphToKph = require('./mphToKph.js'); - -test('mphToKph is a Function', () => { - expect(mphToKph).toBeInstanceOf(Function); -}); -test('Returns kph from mph.', () => { - expect(mphToKph(10)).toBe(16.09344000614692); -}); -test('Returns kph from mph.', () => { - expect(mphToKph(85.9)).toBe(138.24264965280207); -}); From f026e757eed69852626cc1478c5ca59a6121a799 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 16 Oct 2018 20:24:09 +0300 Subject: [PATCH 3/3] Naming fix --- test/kmphToMph/{kphToMph.js => kmphToMph.js} | 0 test/kmphToMph/{kphToMph.test.js => kmphToMph.test.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename test/kmphToMph/{kphToMph.js => kmphToMph.js} (100%) rename test/kmphToMph/{kphToMph.test.js => kmphToMph.test.js} (100%) diff --git a/test/kmphToMph/kphToMph.js b/test/kmphToMph/kmphToMph.js similarity index 100% rename from test/kmphToMph/kphToMph.js rename to test/kmphToMph/kmphToMph.js diff --git a/test/kmphToMph/kphToMph.test.js b/test/kmphToMph/kmphToMph.test.js similarity index 100% rename from test/kmphToMph/kphToMph.test.js rename to test/kmphToMph/kmphToMph.test.js