trackler 2.2.0.0 → 2.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/CONTRIBUTING.md +1 -1
  4. data/tracks/bash/.travis.yml +1 -1
  5. data/tracks/bash/config.json +30 -3
  6. data/tracks/c/README.md +1 -1
  7. data/tracks/c/config.json +131 -39
  8. data/tracks/ceylon/README.md +6 -6
  9. data/tracks/ceylon/config.json +21 -3
  10. data/tracks/chapel/.travis.yml +1 -1
  11. data/tracks/clojurescript/.travis.yml +1 -1
  12. data/tracks/clojurescript/README.md +6 -6
  13. data/tracks/clojurescript/exercises/.keep +0 -0
  14. data/tracks/coffeescript/.travis.yml +1 -1
  15. data/tracks/coldfusion/.travis.yml +1 -1
  16. data/tracks/coq/.travis.yml +1 -1
  17. data/tracks/cpp/CMakeLists.txt +1 -0
  18. data/tracks/cpp/README.md +1 -1
  19. data/tracks/cpp/config.json +8 -0
  20. data/tracks/cpp/exercises/atbash-cipher/CMakeLists.txt +52 -0
  21. data/tracks/cpp/exercises/atbash-cipher/atbash_cipher_test.cpp +68 -0
  22. data/tracks/cpp/exercises/atbash-cipher/example.cpp +54 -0
  23. data/tracks/cpp/exercises/atbash-cipher/example.h +13 -0
  24. data/tracks/csharp/config.json +315 -6
  25. data/tracks/d/.travis.yml +1 -1
  26. data/tracks/dart/README.md +2 -2
  27. data/tracks/dart/config.json +21 -3
  28. data/tracks/delphi/README.md +1 -1
  29. data/tracks/delphi/config.json +83 -1
  30. data/tracks/ecmascript/config.json +10 -0
  31. data/tracks/ecmascript/exercises/accumulate/accumulate.spec.js +3 -9
  32. data/tracks/ecmascript/exercises/acronym/acronym.spec.js +2 -2
  33. data/tracks/ecmascript/exercises/all-your-base/all-your-base.spec.js +131 -133
  34. data/tracks/ecmascript/exercises/all-your-base/example.js +1 -3
  35. data/tracks/ecmascript/exercises/allergies/allergies.spec.js +8 -10
  36. data/tracks/ecmascript/exercises/allergies/example.js +3 -5
  37. data/tracks/ecmascript/exercises/alphametics/alphametics.spec.js +61 -63
  38. data/tracks/ecmascript/exercises/alphametics/example.js +99 -99
  39. data/tracks/ecmascript/exercises/anagram/anagram.spec.js +35 -37
  40. data/tracks/ecmascript/exercises/anagram/example.js +1 -3
  41. data/tracks/ecmascript/exercises/atbash-cipher/atbash-cipher.spec.js +1 -3
  42. data/tracks/ecmascript/exercises/atbash-cipher/example.js +3 -3
  43. data/tracks/ecmascript/exercises/beer-song/beer-song.spec.js +0 -2
  44. data/tracks/ecmascript/exercises/beer-song/example.js +9 -9
  45. data/tracks/ecmascript/exercises/binary/binary.spec.js +1 -2
  46. data/tracks/ecmascript/exercises/binary/example.js +3 -3
  47. data/tracks/ecmascript/exercises/binary-search/binary-search.spec.js +1 -3
  48. data/tracks/ecmascript/exercises/binary-search-tree/binary-search-tree.spec.js +13 -15
  49. data/tracks/ecmascript/exercises/binary-search-tree/example.js +2 -2
  50. data/tracks/ecmascript/exercises/bob/bob.spec.js +1 -3
  51. data/tracks/ecmascript/exercises/bob/example.js +3 -3
  52. data/tracks/ecmascript/exercises/bracket-push/example.js +2 -2
  53. data/tracks/ecmascript/exercises/circular-buffer/circular-buffer.spec.js +10 -12
  54. data/tracks/ecmascript/exercises/circular-buffer/example.js +12 -11
  55. data/tracks/ecmascript/exercises/clock/clock.spec.js +0 -8
  56. data/tracks/ecmascript/exercises/clock/example.js +11 -11
  57. data/tracks/ecmascript/exercises/connect/connect.spec.js +75 -77
  58. data/tracks/ecmascript/exercises/connect/example.js +27 -29
  59. data/tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js +11 -11
  60. data/tracks/ecmascript/exercises/crypto-square/example.js +11 -10
  61. data/tracks/ecmascript/exercises/custom-set/custom-set.spec.js +2 -4
  62. data/tracks/ecmascript/exercises/custom-set/example.js +1 -1
  63. data/tracks/ecmascript/exercises/diamond/diamond.spec.js +20 -21
  64. data/tracks/ecmascript/exercises/diamond/example.js +12 -13
  65. data/tracks/ecmascript/exercises/difference-of-squares/difference-of-squares.spec.js +0 -5
  66. data/tracks/ecmascript/exercises/diffie-hellman/diffie-hellman.spec.js +7 -28
  67. data/tracks/ecmascript/exercises/etl/etl.spec.js +36 -18
  68. data/tracks/ecmascript/exercises/etl/example.js +3 -3
  69. data/tracks/ecmascript/exercises/flatten-array/example.js +1 -1
  70. data/tracks/ecmascript/exercises/flatten-array/flatten-array.spec.js +2 -3
  71. data/tracks/ecmascript/exercises/food-chain/example.js +12 -12
  72. data/tracks/ecmascript/exercises/food-chain/food-chain.spec.js +0 -1
  73. data/tracks/ecmascript/exercises/gigasecond/example.js +1 -1
  74. data/tracks/ecmascript/exercises/gigasecond/gigasecond.spec.js +0 -1
  75. data/tracks/ecmascript/exercises/grade-school/grade-school.spec.js +18 -19
  76. data/tracks/ecmascript/exercises/grains/grains.spec.js +0 -1
  77. data/tracks/ecmascript/exercises/hamming/example.js +3 -3
  78. data/tracks/ecmascript/exercises/hamming/hamming.spec.js +5 -6
  79. data/tracks/ecmascript/exercises/hello-world/example.js +1 -1
  80. data/tracks/ecmascript/exercises/hello-world/hello-world.spec.js +1 -1
  81. data/tracks/ecmascript/exercises/hexadecimal/example.js +2 -2
  82. data/tracks/ecmascript/exercises/hexadecimal/hexadecimal.spec.js +9 -11
  83. data/tracks/ecmascript/exercises/isogram/isogram.spec.js +22 -23
  84. data/tracks/ecmascript/exercises/kindergarten-garden/example.js +7 -7
  85. data/tracks/ecmascript/exercises/kindergarten-garden/kindergarten-garden.spec.js +0 -5
  86. data/tracks/ecmascript/exercises/largest-series-product/example.js +4 -8
  87. data/tracks/ecmascript/exercises/largest-series-product/largest-series-product.spec.js +5 -7
  88. data/tracks/ecmascript/exercises/leap/leap.spec.js +4 -6
  89. data/tracks/ecmascript/exercises/linked-list/example.js +2 -2
  90. data/tracks/ecmascript/exercises/list-ops/example.js +19 -19
  91. data/tracks/ecmascript/exercises/list-ops/list-ops.spec.js +2 -18
  92. data/tracks/ecmascript/exercises/luhn/example.js +1 -1
  93. data/tracks/ecmascript/exercises/luhn/luhn.spec.js +1 -3
  94. data/tracks/ecmascript/exercises/matrix/example.js +2 -4
  95. data/tracks/ecmascript/exercises/matrix/matrix.spec.js +0 -2
  96. data/tracks/ecmascript/exercises/meetup/example.js +12 -15
  97. data/tracks/ecmascript/exercises/meetup/meetup.spec.js +0 -2
  98. data/tracks/ecmascript/exercises/minesweeper/example.js +60 -0
  99. data/tracks/ecmascript/exercises/minesweeper/minesweeper.spec.js +174 -0
  100. data/tracks/ecmascript/exercises/minesweeper/package.json +69 -0
  101. data/tracks/ecmascript/exercises/nth-prime/example.js +3 -2
  102. data/tracks/ecmascript/exercises/nth-prime/nth-prime.spec.js +0 -1
  103. data/tracks/ecmascript/exercises/ocr-numbers/example.js +3 -3
  104. data/tracks/ecmascript/exercises/ocr-numbers/ocr-numbers.spec.js +16 -18
  105. data/tracks/ecmascript/exercises/octal/example.js +1 -1
  106. data/tracks/ecmascript/exercises/octal/octal.spec.js +0 -2
  107. data/tracks/ecmascript/exercises/palindrome-products/example.js +14 -11
  108. data/tracks/ecmascript/exercises/palindrome-products/palindrome-products.spec.js +15 -18
  109. data/tracks/ecmascript/exercises/pangram/example.js +6 -5
  110. data/tracks/ecmascript/exercises/pangram/pangram.spec.js +10 -12
  111. data/tracks/ecmascript/exercises/pascals-triangle/example.js +2 -2
  112. data/tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js +6 -8
  113. data/tracks/ecmascript/exercises/perfect-numbers/example.js +3 -5
  114. data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +0 -10
  115. data/tracks/ecmascript/exercises/phone-number/example.js +2 -2
  116. data/tracks/ecmascript/exercises/phone-number/phone-number.spec.js +0 -2
  117. data/tracks/ecmascript/exercises/pig-latin/example.js +4 -4
  118. data/tracks/ecmascript/exercises/pig-latin/pig-latin.spec.js +0 -1
  119. data/tracks/ecmascript/exercises/prime-factors/example.js +2 -2
  120. data/tracks/ecmascript/exercises/prime-factors/prime-factors.spec.js +0 -2
  121. data/tracks/ecmascript/exercises/pythagorean-triplet/pythagorean-triplet.spec.js +3 -11
  122. data/tracks/ecmascript/exercises/queen-attack/example.js +17 -17
  123. data/tracks/ecmascript/exercises/queen-attack/queen-attack.spec.js +7 -8
  124. data/tracks/ecmascript/exercises/raindrops/example.js +1 -1
  125. data/tracks/ecmascript/exercises/raindrops/raindrops.spec.js +1 -2
  126. data/tracks/ecmascript/exercises/rna-transcription/example.js +5 -5
  127. data/tracks/ecmascript/exercises/rna-transcription/rna-transcription.spec.js +4 -5
  128. data/tracks/ecmascript/exercises/robot-name/example.js +6 -6
  129. data/tracks/ecmascript/exercises/robot-name/robot-name.spec.js +10 -11
  130. data/tracks/ecmascript/exercises/robot-simulator/example.js +1 -1
  131. data/tracks/ecmascript/exercises/robot-simulator/robot-simulator.spec.js +31 -32
  132. data/tracks/ecmascript/exercises/roman-numerals/example.js +16 -16
  133. data/tracks/ecmascript/exercises/saddle-points/saddle-points.spec.js +3 -3
  134. data/tracks/ecmascript/exercises/say/example.js +25 -25
  135. data/tracks/ecmascript/exercises/say/say.spec.js +2 -3
  136. data/tracks/ecmascript/exercises/scrabble-score/example.js +27 -9
  137. data/tracks/ecmascript/exercises/scrabble-score/scrabble-score.spec.js +6 -7
  138. data/tracks/ecmascript/exercises/secret-handshake/example.js +2 -3
  139. data/tracks/ecmascript/exercises/secret-handshake/secret-handshake.spec.js +3 -5
  140. data/tracks/ecmascript/exercises/series/series.spec.js +1 -3
  141. data/tracks/ecmascript/exercises/sieve/example.js +4 -3
  142. data/tracks/ecmascript/exercises/sieve/sieve.spec.js +0 -2
  143. data/tracks/ecmascript/exercises/simple-cipher/example.js +8 -9
  144. data/tracks/ecmascript/exercises/simple-cipher/simple-cipher.spec.js +4 -4
  145. data/tracks/ecmascript/exercises/space-age/example.js +1 -1
  146. data/tracks/ecmascript/exercises/space-age/space-age.spec.js +9 -11
  147. data/tracks/ecmascript/exercises/strain/example.js +4 -4
  148. data/tracks/ecmascript/exercises/strain/strain.spec.js +14 -16
  149. data/tracks/ecmascript/exercises/sum-of-multiples/example.js +4 -4
  150. data/tracks/ecmascript/exercises/triangle/triangle.spec.js +2 -4
  151. data/tracks/ecmascript/exercises/trinary/example.js +3 -3
  152. data/tracks/ecmascript/exercises/trinary/trinary.spec.js +0 -2
  153. data/tracks/ecmascript/exercises/two-bucket/example.js +30 -27
  154. data/tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js +4 -8
  155. data/tracks/ecmascript/exercises/word-count/example.js +2 -2
  156. data/tracks/ecmascript/exercises/word-count/word-count.spec.js +2 -3
  157. data/tracks/ecmascript/exercises/wordy/example.js +6 -6
  158. data/tracks/ecmascript/exercises/wordy/wordy.spec.js +2 -4
  159. data/tracks/factor/config.json +15 -6
  160. data/tracks/fortran/.travis.yml +1 -1
  161. data/tracks/fsharp/config.json +312 -10
  162. data/tracks/go/README.md +1 -1
  163. data/tracks/go/config.json +523 -155
  164. data/tracks/haskell/README.md +2 -2
  165. data/tracks/haskell/config.json +256 -7
  166. data/tracks/haxe/.travis.yml +1 -1
  167. data/tracks/haxe/Makefile +2 -2
  168. data/tracks/haxe/config.json +8 -5
  169. data/tracks/java/CONTRIBUTING.md +2 -2
  170. data/tracks/java/config.json +277 -17
  171. data/tracks/java/exercises/rotational-cipher/build.gradle +17 -0
  172. data/tracks/java/exercises/rotational-cipher/src/example/java/RotationalCipher.java +37 -0
  173. data/tracks/java/exercises/rotational-cipher/src/main/java/.keep +0 -0
  174. data/tracks/java/exercises/rotational-cipher/src/test/java/RotationalCipherTest.java +81 -0
  175. data/tracks/java/exercises/settings.gradle +1 -0
  176. data/tracks/java/exercises/twelve-days/src/main/java/TwelveDays.java +4 -0
  177. data/tracks/julia/.travis.yml +1 -1
  178. data/tracks/julia/README.md +1 -1
  179. data/tracks/kotlin/README.md +2 -2
  180. data/tracks/kotlin/exercises/hello-world/TUTORIAL.md +3 -3
  181. data/tracks/lisp/config.json +97 -3
  182. data/tracks/lisp/exercises/pascals-triangle/example.lisp +21 -0
  183. data/tracks/lisp/exercises/pascals-triangle/pascal.lisp +7 -0
  184. data/tracks/lisp/exercises/pascals-triangle/pascals-triangle-test.lisp +34 -0
  185. data/tracks/lua/.travis.yml +1 -1
  186. data/tracks/lua/README.md +1 -1
  187. data/tracks/mips/.travis.yml +1 -1
  188. data/tracks/mips/config.json +56 -17
  189. data/tracks/nasm/.travis.yml +1 -1
  190. data/tracks/nim/.travis.yml +1 -1
  191. data/tracks/ocaml/README.md +3 -3
  192. data/tracks/ocaml/config.json +130 -4
  193. data/tracks/perl5/docs/TESTS.md +40 -26
  194. data/tracks/plsql/.travis.yml +1 -1
  195. data/tracks/plsql/config.json +40 -13
  196. data/tracks/pony/.travis.yml +1 -1
  197. data/tracks/pony/bin/install-deps +4 -3
  198. data/tracks/prolog/.travis.yml +1 -1
  199. data/tracks/r/README.md +5 -5
  200. data/tracks/r/config.json +102 -30
  201. data/tracks/rust/.travis.yml +1 -1
  202. data/tracks/rust/config.json +172 -4
  203. data/tracks/rust/docs/EXERCISE_README_INSERT.md +1 -1
  204. data/tracks/sml/config.json +26 -3
  205. data/tracks/vimscript/config.json +60 -3
  206. metadata +16 -1
@@ -1,38 +1,37 @@
1
1
  import Hexadecimal from './hexadecimal';
2
2
 
3
3
  describe('Hexadecimal', () => {
4
-
5
- test('hex 1 is decimal 1', () => {
4
+ test('hex 1 is decimal 1', () => {
6
5
  const hex = new Hexadecimal('1');
7
6
  expect(hex.toDecimal()).toEqual(1);
8
7
  });
9
8
 
10
- xtest('hex c is decimal 12', () => {
9
+ xtest('hex c is decimal 12', () => {
11
10
  const hex = new Hexadecimal('c');
12
11
  expect(hex.toDecimal()).toEqual(12);
13
12
  });
14
13
 
15
- xtest('hex 10 is decimal 16', () => {
14
+ xtest('hex 10 is decimal 16', () => {
16
15
  const hex = new Hexadecimal('10');
17
16
  expect(hex.toDecimal()).toEqual(16);
18
17
  });
19
18
 
20
- xtest('hex af is decimal 175', () => {
19
+ xtest('hex af is decimal 175', () => {
21
20
  const hex = new Hexadecimal('af');
22
21
  expect(hex.toDecimal()).toEqual(175);
23
22
  });
24
23
 
25
- xtest('hex 100 is decimal 256', () => {
24
+ xtest('hex 100 is decimal 256', () => {
26
25
  const hex = new Hexadecimal('100');
27
26
  expect(hex.toDecimal()).toEqual(256);
28
27
  });
29
28
 
30
- xtest('hex 19ace is decimal 105166', () => {
29
+ xtest('hex 19ace is decimal 105166', () => {
31
30
  const hex = new Hexadecimal('19ace');
32
31
  expect(hex.toDecimal()).toEqual(105166);
33
32
  });
34
33
 
35
- xtest('invalid hex is decimal 0', () => {
34
+ xtest('invalid hex is decimal 0', () => {
36
35
  const hex = new Hexadecimal('carrot');
37
36
  expect(hex.toDecimal()).toEqual(0);
38
37
  });
@@ -42,14 +41,13 @@ describe('Hexadecimal', () => {
42
41
  expect(hex.toDecimal()).toEqual(0);
43
42
  });
44
43
 
45
- xtest('hexadecimal value for HTML/CSS white color', () => {
44
+ xtest('hexadecimal value for HTML/CSS white color', () => {
46
45
  const hex = new Hexadecimal('ffffff');
47
46
  expect(hex.toDecimal()).toEqual(16777215);
48
47
  });
49
48
 
50
- xtest('hexadecimal value for HTML/CSS yellow color', () => {
49
+ xtest('hexadecimal value for HTML/CSS yellow color', () => {
51
50
  const hex = new Hexadecimal('ffff00');
52
51
  expect(hex.toDecimal()).toEqual(16776960);
53
52
  });
54
-
55
53
  });
@@ -1,64 +1,63 @@
1
- import Isogram from './isogram.js'
1
+ import Isogram from './isogram.js';
2
2
 
3
- describe('Isogram Test Suite', function () {
4
- test('duplicates', function () {
5
- var word = new Isogram('duplicates');
3
+ describe('Isogram Test Suite', () => {
4
+ test('duplicates', () => {
5
+ const word = new Isogram('duplicates');
6
6
 
7
7
  expect(word.isIsogram()).toEqual(true);
8
8
  });
9
9
 
10
- xtest('eleven', function () {
11
- var word = new Isogram('eleven');
10
+ xtest('eleven', () => {
11
+ const word = new Isogram('eleven');
12
12
 
13
13
  expect(word.isIsogram()).toEqual(false);
14
14
  });
15
15
 
16
- xtest('subdermatoglyphic', function () {
17
- var word = new Isogram('subdermatoglyphic');
16
+ xtest('subdermatoglyphic', () => {
17
+ const word = new Isogram('subdermatoglyphic');
18
18
 
19
19
  expect(word.isIsogram()).toEqual(true);
20
20
  });
21
21
 
22
- xtest('Alphabet', function () {
23
- var word = new Isogram('Alphabet');
22
+ xtest('Alphabet', () => {
23
+ const word = new Isogram('Alphabet');
24
24
 
25
25
  expect(word.isIsogram()).toEqual(false);
26
26
  });
27
27
 
28
- xtest('thumbscrew-japingly', function () {
29
- var word = new Isogram('thumbscrew-japingly');
28
+ xtest('thumbscrew-japingly', () => {
29
+ const word = new Isogram('thumbscrew-japingly');
30
30
 
31
31
  expect(word.isIsogram()).toEqual(true);
32
32
  });
33
33
 
34
- xtest('Hjelmqvist-Gryb-Zock-Pfund-Wax', function () {
35
- var word = new Isogram('Hjelmqvist-Gryb-Zock-Pfund-Wax');
34
+ xtest('Hjelmqvist-Gryb-Zock-Pfund-Wax', () => {
35
+ const word = new Isogram('Hjelmqvist-Gryb-Zock-Pfund-Wax');
36
36
 
37
37
  expect(word.isIsogram()).toEqual(true);
38
38
  });
39
39
 
40
- xtest('Heizölrückstoßabdämpfung', function () {
41
- var word = new Isogram('Heizölrückstoßabdämpfung');
40
+ xtest('Heizölrückstoßabdämpfung', () => {
41
+ const word = new Isogram('Heizölrückstoßabdämpfung');
42
42
 
43
43
  expect(word.isIsogram()).toEqual(true);
44
44
  });
45
45
 
46
- xtest('the quick brown fox', function () {
47
- var word = new Isogram('the quick brown fox');
46
+ xtest('the quick brown fox', () => {
47
+ const word = new Isogram('the quick brown fox');
48
48
 
49
49
  expect(word.isIsogram()).toEqual(false);
50
50
  });
51
51
 
52
- xtest('Emily Jung Schwartzkopf', function () {
53
- var word = new Isogram('Emily Jung Schwartzkopf');
52
+ xtest('Emily Jung Schwartzkopf', () => {
53
+ const word = new Isogram('Emily Jung Schwartzkopf');
54
54
 
55
55
  expect(word.isIsogram()).toEqual(true);
56
56
  });
57
57
 
58
- xtest('éléphant', function () {
59
- var word = new Isogram('éléphant');
58
+ xtest('éléphant', () => {
59
+ const word = new Isogram('éléphant');
60
60
 
61
61
  expect(word.isIsogram()).toEqual(false);
62
62
  });
63
-
64
63
  });
@@ -10,28 +10,28 @@ const defaultChildren = [
10
10
  'Ileana',
11
11
  'Joseph',
12
12
  'Kincaid',
13
- 'Larry'
13
+ 'Larry',
14
14
  ];
15
15
 
16
16
  const plants = {
17
17
  G: 'grass',
18
18
  V: 'violets',
19
19
  R: 'radishes',
20
- C: 'clover'
20
+ C: 'clover',
21
21
  };
22
22
 
23
23
  function getPlants(pots, index) {
24
- let plants = [];
25
- const position = 2*index;
24
+ const plants = [];
25
+ const position = 2 * index;
26
26
  plants.push(pots[0][position]);
27
- plants.push(pots[0][position+1]);
27
+ plants.push(pots[0][position + 1]);
28
28
  plants.push(pots[1][position]);
29
- plants.push(pots[1][position+1]);
29
+ plants.push(pots[1][position + 1]);
30
30
  return plants;
31
31
  }
32
32
 
33
33
  function parse(diagram) {
34
- return diagram.split('\n').map((row) => [...row].map((sign) => plants[sign]));
34
+ return diagram.split('\n').map(row => [...row].map(sign => plants[sign]));
35
35
  }
36
36
 
37
37
  class Garden {
@@ -1,7 +1,6 @@
1
1
  import Garden from './kindergarten-garden';
2
2
 
3
3
  describe('Garden', () => {
4
-
5
4
  test('for Alice', () => {
6
5
  expect(new Garden('RC\nGG').alice)
7
6
  .toEqual(['radishes', 'clover', 'grass', 'grass']);
@@ -22,7 +21,6 @@ describe('Garden', () => {
22
21
  expect(garden.bob).toEqual(['clover', 'clover', 'clover', 'clover']);
23
22
  expect(garden.charlie).toEqual(['grass', 'grass', 'grass', 'grass']);
24
23
  });
25
-
26
24
  });
27
25
 
28
26
  describe('Full garden', () => {
@@ -88,7 +86,6 @@ describe('Full garden', () => {
88
86
  expect(garden.larry)
89
87
  .toEqual(['grass', 'violets', 'clover', 'violets']);
90
88
  });
91
-
92
89
  });
93
90
 
94
91
  describe('Disordered class', () => {
@@ -115,7 +112,6 @@ describe('Disordered class', () => {
115
112
  expect(garden.xander)
116
113
  .toEqual(['radishes', 'grass', 'clover', 'violets']);
117
114
  });
118
-
119
115
  });
120
116
 
121
117
  describe('Two gardens, different students', () => {
@@ -133,5 +129,4 @@ describe('Two gardens, different students', () => {
133
129
  expect(garden2.charlie)
134
130
  .toEqual(['radishes', 'radishes', 'grass', 'clover']);
135
131
  });
136
-
137
132
  });
@@ -1,7 +1,7 @@
1
1
  export default class Series {
2
2
 
3
3
  constructor(numberString) {
4
- if(numberString.match('[^0-9]')) {
4
+ if (numberString.match('[^0-9]')) {
5
5
  throw new Error('Invalid input.');
6
6
  }
7
7
 
@@ -10,9 +10,7 @@ export default class Series {
10
10
  }
11
11
 
12
12
  getDigits() {
13
- return [...this.numberString].map( digit => {
14
- return parseInt(digit, 10);
15
- });
13
+ return [...this.numberString].map(digit => parseInt(digit, 10));
16
14
  }
17
15
 
18
16
  largestProduct(size) {
@@ -22,10 +20,8 @@ export default class Series {
22
20
 
23
21
  let product,
24
22
  max = 0;
25
- this.slices(size).forEach( slice => {
26
- product = slice.reduce( (a, b) => {
27
- return a * b;
28
- }, 1);
23
+ this.slices(size).forEach((slice) => {
24
+ product = slice.reduce((a, b) => a * b, 1);
29
25
  if (product > max) {
30
26
  max = product;
31
27
  }
@@ -1,7 +1,6 @@
1
1
  import Series from './largest-series-product';
2
2
 
3
3
  describe('Series', () => {
4
-
5
4
  test('can get the largest product of 2', () => {
6
5
  expect(new Series('0123456789').largestProduct(2)).toBe(72);
7
6
  });
@@ -35,15 +34,15 @@ describe('Series', () => {
35
34
  expect(new Series('99099').largestProduct(3)).toBe(0);
36
35
  });
37
36
 
38
- xtest('rejects invalid character in input', ()=> {
39
- expect(()=> {
40
- new Series('1234a5').largestProduct('2')
37
+ xtest('rejects invalid character in input', () => {
38
+ expect(() => {
39
+ new Series('1234a5').largestProduct('2');
41
40
  }).toThrow(new Error('Invalid input.'));
42
41
  });
43
42
 
44
- xtest('rejects negative span', ()=> {
43
+ xtest('rejects negative span', () => {
45
44
  expect(() => {
46
- new Series('12345').largestProduct(-1)
45
+ new Series('12345').largestProduct(-1);
47
46
  }).toThrow(new Error('Invalid input.'));
48
47
  });
49
48
 
@@ -66,5 +65,4 @@ describe('Series', () => {
66
65
  new Series('').largestProduct(1);
67
66
  }).toThrow(new Error('Slice size is too big.'));
68
67
  });
69
-
70
68
  });
@@ -1,25 +1,23 @@
1
1
  import Year from './leap';
2
2
 
3
3
  describe('A leap year', () => {
4
-
5
4
  test('year not divisible by 4: common year', () => {
6
- let year = new Year(2015);
5
+ const year = new Year(2015);
7
6
  expect(year.isLeap()).toBeFalsy();
8
7
  });
9
8
 
10
9
  xtest('year divisible by 4, not divisible by 100: leap year', () => {
11
- let year = new Year(2016);
10
+ const year = new Year(2016);
12
11
  expect(year.isLeap()).toBeTruthy();
13
12
  });
14
13
 
15
14
  xtest('year divisible by 100, not divisible by 400: common year', () => {
16
- let year = new Year(2100);
15
+ const year = new Year(2100);
17
16
  expect(year.isLeap()).toBeFalsy();
18
17
  });
19
18
 
20
19
  xtest('year divisible by 400: leap year', () => {
21
- let year = new Year(2000);
20
+ const year = new Year(2000);
22
21
  expect(year.isLeap()).toBeTruthy();
23
22
  });
24
-
25
23
  });
@@ -1,5 +1,5 @@
1
1
  function Element(value) {
2
- return {value: value, next: null, prev: null}
2
+ return { value, next: null, prev: null };
3
3
  }
4
4
 
5
5
  export default class Deque {
@@ -67,7 +67,7 @@ export default class Deque {
67
67
 
68
68
  count() {
69
69
  let count = 0,
70
- element = this.head;
70
+ element = this.head;
71
71
 
72
72
  while (this.head && element) {
73
73
  count++;
@@ -1,24 +1,24 @@
1
1
  class List {
2
2
 
3
- constructor(arr){
3
+ constructor(arr) {
4
4
  this.values = arr || [];
5
5
  }
6
6
 
7
- append(otherList){
8
- for (let el of otherList.values){
7
+ append(otherList) {
8
+ for (const el of otherList.values) {
9
9
  this.values.push(el);
10
10
  }
11
11
  return this;
12
12
  }
13
13
 
14
- concat(otherList){
14
+ concat(otherList) {
15
15
  return this.append(otherList);
16
16
  }
17
17
 
18
- filter(operation){
18
+ filter(operation) {
19
19
  const filteredValues = [];
20
- for (let el of this.values){
21
- if (operation(el)){
20
+ for (const el of this.values) {
21
+ if (operation(el)) {
22
22
  filteredValues.push(el);
23
23
  }
24
24
  }
@@ -26,45 +26,45 @@ class List {
26
26
  return this;
27
27
  }
28
28
 
29
- length(){
29
+ length() {
30
30
  let length = 0;
31
- for (let el of this.values){
31
+ for (const el of this.values) {
32
32
  length++;
33
33
  }
34
34
  return length;
35
35
  }
36
36
 
37
- map(operation){
37
+ map(operation) {
38
38
  const mappedValues = [];
39
- for (let el of this.values){
39
+ for (const el of this.values) {
40
40
  mappedValues.push(operation(el));
41
41
  }
42
42
  this.values = mappedValues;
43
43
  return this;
44
44
  }
45
45
 
46
- foldl(operation, initialValue){
46
+ foldl(operation, initialValue) {
47
47
  let acc = initialValue;
48
- for (let el of this.values){
48
+ for (const el of this.values) {
49
49
  acc = operation(acc, el);
50
50
  }
51
51
  return acc;
52
52
  }
53
53
 
54
- foldr(operation, initialValue){
54
+ foldr(operation, initialValue) {
55
55
  let acc = initialValue;
56
- let index = this.length() -1;
57
- while (index >= 0){
58
- let el = this.values[index--];
56
+ let index = this.length() - 1;
57
+ while (index >= 0) {
58
+ const el = this.values[index--];
59
59
  acc = operation(acc, el);
60
60
  }
61
61
  return acc;
62
62
  }
63
63
 
64
- reverse(){
64
+ reverse() {
65
65
  const numElements = this.length();
66
66
  let finalIndex = numElements - 1;
67
- for (let index = 0; index < numElements/2; index++){
67
+ for (let index = 0; index < numElements / 2; index++) {
68
68
  const temp = this.values[index];
69
69
  this.values[index] = this.values[finalIndex];
70
70
  this.values[finalIndex--] = temp;
@@ -2,7 +2,6 @@ import List from './list-ops';
2
2
 
3
3
 
4
4
  describe('append entries to a list and return the new list', () => {
5
-
6
5
  test('empty lists', () => {
7
6
  const list1 = new List();
8
7
  const list2 = new List();
@@ -20,12 +19,10 @@ describe('append entries to a list and return the new list', () => {
20
19
  const list2 = new List([2, 3, 4, 5]);
21
20
  expect(list1.append(list2).values).toEqual([1, 2, 2, 3, 4, 5]);
22
21
  });
23
-
24
22
  });
25
23
 
26
24
 
27
25
  describe('concat lists and lists of lists into new list', () => {
28
-
29
26
  xtest('empty list', () => {
30
27
  const list1 = new List();
31
28
  const list2 = new List();
@@ -39,27 +36,23 @@ describe('concat lists and lists of lists into new list', () => {
39
36
  const list4 = new List([4, 5, 6]);
40
37
  expect(list1.concat(list2).concat(list3).concat(list4).values).toEqual([1, 2, 3, 4, 5, 6]);
41
38
  });
42
-
43
39
  });
44
40
 
45
41
 
46
42
  describe('filter list returning only values that satisfy the filter function', () => {
47
-
48
43
  xtest('empty list', () => {
49
44
  const list1 = new List([]);
50
- expect(list1.filter((el) => el % 2 === 1).values).toEqual([]);
45
+ expect(list1.filter(el => el % 2 === 1).values).toEqual([]);
51
46
  });
52
47
 
53
48
  xtest('non empty list', () => {
54
49
  const list1 = new List([1, 2, 3, 5]);
55
- expect(list1.filter((el) => el % 2 === 1).values).toEqual([1, 3, 5]);
50
+ expect(list1.filter(el => el % 2 === 1).values).toEqual([1, 3, 5]);
56
51
  });
57
-
58
52
  });
59
53
 
60
54
 
61
55
  describe('returns the length of a list', () => {
62
-
63
56
  xtest('empty list', () => {
64
57
  const list1 = new List();
65
58
  expect(list1.length()).toEqual(0);
@@ -69,12 +62,10 @@ describe('returns the length of a list', () => {
69
62
  const list1 = new List([1, 2, 3, 4]);
70
63
  expect(list1.length()).toEqual(4);
71
64
  });
72
-
73
65
  });
74
66
 
75
67
 
76
68
  describe('returns a list of elements whose values equal the list value transformed by the mapping function', () => {
77
-
78
69
  xtest('empty list', () => {
79
70
  const list1 = new List();
80
71
  expect(list1.map(el => ++el).values).toEqual([]);
@@ -84,12 +75,10 @@ describe('returns a list of elements whose values equal the list value transform
84
75
  const list1 = new List([1, 3, 5, 7]);
85
76
  expect(list1.map(el => ++el).values).toEqual([2, 4, 6, 8]);
86
77
  });
87
-
88
78
  });
89
79
 
90
80
 
91
81
  describe('folds (reduces) the given list from the left with a function', () => {
92
-
93
82
  xtest('empty list', () => {
94
83
  const list1 = new List();
95
84
  expect(list1.foldl((acc, el) => el / acc, 2)).toEqual(2);
@@ -99,12 +88,10 @@ describe('folds (reduces) the given list from the left with a function', () => {
99
88
  const list1 = new List([1, 2, 3, 4]);
100
89
  expect(list1.foldl((acc, el) => el / acc, 24)).toEqual(64);
101
90
  });
102
-
103
91
  });
104
92
 
105
93
 
106
94
  describe('folds (reduces) the given list from the right with a function', () => {
107
-
108
95
  xtest('empty list', () => {
109
96
  const list1 = new List();
110
97
  expect(list1.foldr((acc, el) => el / acc, 2)).toEqual(2);
@@ -114,12 +101,10 @@ describe('folds (reduces) the given list from the right with a function', () =>
114
101
  const list1 = new List([1, 2, 3, 4]);
115
102
  expect(list1.foldr((acc, el) => el / acc, 24)).toEqual(9);
116
103
  });
117
-
118
104
  });
119
105
 
120
106
 
121
107
  describe('reverse the elements of a list', () => {
122
-
123
108
  xtest('empty list', () => {
124
109
  const list1 = new List();
125
110
  expect(list1.reverse().values).toEqual([]);
@@ -129,5 +114,4 @@ describe('reverse the elements of a list', () => {
129
114
  const list1 = new List([1, 3, 5, 7]);
130
115
  expect(list1.reverse().values).toEqual([7, 5, 3, 1]);
131
116
  });
132
-
133
117
  });
@@ -13,7 +13,7 @@ function isValid(number) {
13
13
  return d;
14
14
  })
15
15
  // limit to digits less than 10
16
- .map(d => {
16
+ .map((d) => {
17
17
  if (d > 9) {
18
18
  return d - 9;
19
19
  }
@@ -1,7 +1,6 @@
1
1
  import Luhn from './luhn';
2
2
 
3
- describe('Luhn',() => {
4
-
3
+ describe('Luhn', () => {
5
4
  test('single digit strings can not be valid', () => {
6
5
  const luhn = new Luhn('1');
7
6
  expect(luhn.valid).toEqual(false);
@@ -31,5 +30,4 @@ describe('Luhn',() => {
31
30
  const luhn = new Luhn('046a 454 286');
32
31
  expect(luhn.valid).toEqual(false);
33
32
  });
34
-
35
33
  });
@@ -1,5 +1,5 @@
1
1
  function columnsFromRows(rows) {
2
- let columns = [];
2
+ const columns = [];
3
3
 
4
4
  rows.forEach((row) => {
5
5
  row.forEach((n, index) => {
@@ -12,9 +12,7 @@ function columnsFromRows(rows) {
12
12
  }
13
13
 
14
14
  function parseRows(description) {
15
- return description.split('\n').map((row) => {
16
- return row.split(' ').map((char) => parseInt(char, 10));
17
- });
15
+ return description.split('\n').map(row => row.split(' ').map(char => parseInt(char, 10)));
18
16
  }
19
17
 
20
18
  class Matrix {
@@ -1,7 +1,6 @@
1
1
  import Matrix from './matrix';
2
2
 
3
3
  describe('Matrix', () => {
4
-
5
4
  test('can extract a row', () => {
6
5
  expect(new Matrix('1 2\n10 20').rows[0]).toEqual([1, 2]);
7
6
  });
@@ -14,5 +13,4 @@ describe('Matrix', () => {
14
13
  expect(new Matrix('89 1903 3\n18 3 1\n9 4 800').columns[1])
15
14
  .toEqual([1903, 3, 4]);
16
15
  });
17
-
18
16
  });
@@ -1,14 +1,11 @@
1
- export default function meetupDay (year, month, dayOfWeek, which) {
2
-
3
- let candidates = getCandidates(year, month, dayOfWeek);
1
+ export default function meetupDay(year, month, dayOfWeek, which) {
2
+ const candidates = getCandidates(year, month, dayOfWeek);
4
3
  let res;
5
4
 
6
5
  which = which.toLowerCase();
7
6
 
8
7
  if (which === 'teenth') {
9
- res = find(candidates, d => {
10
- return 13 <= d.getDate() && d.getDate() <= 19;
11
- });
8
+ res = find(candidates, d => d.getDate() >= 13 && d.getDate() <= 19);
12
9
  } else if (which === 'last') {
13
10
  res = candidates.pop();
14
11
  } else {
@@ -21,7 +18,7 @@ export default function meetupDay (year, month, dayOfWeek, which) {
21
18
  return res;
22
19
  }
23
20
 
24
- function getCandidates (year, month, dayOfWeek) {
21
+ function getCandidates(year, month, dayOfWeek) {
25
22
  let d,
26
23
  i,
27
24
  numDaysInMonth = new Date(year, month + 1, 0).getDate(),
@@ -38,15 +35,15 @@ function getCandidates (year, month, dayOfWeek) {
38
35
  return res;
39
36
  }
40
37
 
41
- function getDayIndex (day) {
38
+ function getDayIndex(day) {
42
39
  const daysInd = {
43
- 'sunday': 0,
44
- 'monday': 1,
45
- 'tuesday': 2,
46
- 'wednesday': 3,
47
- 'thursday': 4,
48
- 'friday': 5,
49
- 'saturday': 6
40
+ sunday: 0,
41
+ monday: 1,
42
+ tuesday: 2,
43
+ wednesday: 3,
44
+ thursday: 4,
45
+ friday: 5,
46
+ saturday: 6,
50
47
  };
51
48
 
52
49
  day = day.toLowerCase();
@@ -1,7 +1,6 @@
1
1
  import meetupDay from './meetup';
2
2
 
3
3
  describe('meetupDay()', () => {
4
-
5
4
  test('test monteenth of may 2013', () => {
6
5
  expect(meetupDay(2013, 4, 'Monday', 'teenth')).toEqual(new Date(2013, 4, 13));
7
6
  });
@@ -55,5 +54,4 @@ describe('meetupDay()', () => {
55
54
  meetupDay(2015, 1, 'Monday', '5th');
56
55
  }).toThrow();
57
56
  });
58
-
59
57
  });