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,33 +1,32 @@
1
- import Diamond from './diamond.js'
1
+ import Diamond from './diamond.js';
2
2
 
3
3
  describe('Make diamond function', () => {
4
+ const diamond = new Diamond();
4
5
 
5
- var diamond = new Diamond();
6
-
7
- test('test letter A', function() {
8
- const result = "A\n";
6
+ test('test letter A', () => {
7
+ const result = 'A\n';
9
8
  expect(diamond.makeDiamond('A')).toEqual(result);
10
9
  });
11
10
 
12
- xtest('test letter C', function() {
13
- const result = [" A ",
14
- " B B ",
15
- "C C",
16
- " B B ",
17
- " A "].join("\n") + "\n";
11
+ xtest('test letter C', () => {
12
+ const result = `${[' A ',
13
+ ' B B ',
14
+ 'C C',
15
+ ' B B ',
16
+ ' A '].join('\n')}\n`;
18
17
  expect(diamond.makeDiamond('C')).toEqual(result);
19
18
  });
20
19
 
21
- xtest('test letter E', function() {
22
- const result = [" A ",
23
- " B B ",
24
- " C C ",
25
- " D D ",
26
- "E E",
27
- " D D ",
28
- " C C ",
29
- " B B ",
30
- " A "].join("\n") + "\n";
20
+ xtest('test letter E', () => {
21
+ const result = `${[' A ',
22
+ ' B B ',
23
+ ' C C ',
24
+ ' D D ',
25
+ 'E E',
26
+ ' D D ',
27
+ ' C C ',
28
+ ' B B ',
29
+ ' A '].join('\n')}\n`;
31
30
  expect(diamond.makeDiamond('E')).toEqual(result);
32
31
  });
33
32
  });
@@ -1,12 +1,12 @@
1
1
  export default class Diamond {
2
2
  makeDiamond(input) {
3
- const inputIndex = input.charCodeAt() - 65;
4
- var output = "";
5
- var i = 0;
6
- for(i = 0; i <= inputIndex; i++){
3
+ const inputIndex = input.charCodeAt() - 65;
4
+ let output = '';
5
+ let i = 0;
6
+ for (i = 0; i <= inputIndex; i++) {
7
7
  output += getLine(inputIndex, i);
8
8
  }
9
- for(i = inputIndex - 1; i >= 0; i--){
9
+ for (i = inputIndex - 1; i >= 0; i--) {
10
10
  output += getLine(inputIndex, i);
11
11
  }
12
12
  return output;
@@ -14,19 +14,18 @@ export default class Diamond {
14
14
  }
15
15
 
16
16
  function getLine(inputIndex, index) {
17
- var difference = inputIndex - index;
18
- return spaceTimes(difference) + printAlphabets(index) + spaceTimes(difference) + "\n";
17
+ const difference = inputIndex - index;
18
+ return `${spaceTimes(difference) + printAlphabets(index) + spaceTimes(difference)}\n`;
19
19
  }
20
20
 
21
21
  function printAlphabets(index) {
22
- var character = 65 + index;
23
- if(index === 0){
24
- return "A";
25
- } else {
26
- return String.fromCharCode(character) + spaceTimes((index - 1) * 2 + 1) + String.fromCharCode(character);
22
+ const character = 65 + index;
23
+ if (index === 0) {
24
+ return 'A';
27
25
  }
26
+ return String.fromCharCode(character) + spaceTimes((index - 1) * 2 + 1) + String.fromCharCode(character);
28
27
  }
29
28
 
30
29
  function spaceTimes(times) {
31
- return " ".repeat(times);
30
+ return ' '.repeat(times);
32
31
  }
@@ -1,7 +1,6 @@
1
1
  import Squares from './difference-of-squares';
2
2
 
3
3
  describe('Squares', () => {
4
-
5
4
  describe('up to 5', () => {
6
5
  const squares = new Squares(5);
7
6
 
@@ -16,7 +15,6 @@ describe('Squares', () => {
16
15
  xtest('gets the difference', () => {
17
16
  expect(squares.difference).toBe(170);
18
17
  });
19
-
20
18
  });
21
19
 
22
20
  describe('up to 10', () => {
@@ -33,7 +31,6 @@ describe('Squares', () => {
33
31
  xtest('gets the difference', () => {
34
32
  expect(squares.difference).toBe(2640);
35
33
  });
36
-
37
34
  });
38
35
 
39
36
  describe('up to 100', () => {
@@ -50,7 +47,5 @@ describe('Squares', () => {
50
47
  xtest('gets the difference', () => {
51
48
  expect(squares.difference).toBe(25164150);
52
49
  });
53
-
54
50
  });
55
-
56
51
  });
@@ -12,75 +12,56 @@ describe('diffie-hellman', () => {
12
12
  const bobPublicKey = 19;
13
13
 
14
14
  test('throws an error if the constructor arguments are out of range', () => {
15
-
16
15
  expect(() => {
17
- new DiffieHellman(0, 9999)
16
+ new DiffieHellman(0, 9999);
18
17
  }).toThrow();
19
-
20
18
  });
21
19
 
22
20
  xtest('throws an error if the constructor arguments are not prime', () => {
23
-
24
21
  expect(() => {
25
- new DiffieHellman(10, 13)
22
+ new DiffieHellman(10, 13);
26
23
  }).toThrow();
27
-
28
24
  });
29
25
 
30
26
  xtest('throws an error if private key is negative', () => {
31
-
32
27
  expect(() => {
33
- diffieHellman.getPublicKeyFromPrivateKey(-1)
28
+ diffieHellman.getPublicKeyFromPrivateKey(-1);
34
29
  }).toThrow();
35
-
36
30
  });
37
31
 
38
32
  xtest('throws an error if private key is zero', () => {
39
-
40
33
  expect(() => {
41
- diffieHellman.getPublicKeyFromPrivateKey(0)
34
+ diffieHellman.getPublicKeyFromPrivateKey(0);
42
35
  }).toThrow();
43
-
44
36
  });
45
37
 
46
38
  xtest('throws an error if private key is one', () => {
47
-
48
39
  expect(() => {
49
- diffieHellman.getPublicKeyFromPrivateKey(1)
40
+ diffieHellman.getPublicKeyFromPrivateKey(1);
50
41
  }).toThrow();
51
-
52
42
  });
53
43
 
54
44
  xtest('throws an error if private key equals the modulus parameter p', () => {
55
-
56
45
  expect(() => {
57
- diffieHellman.getPublicKeyFromPrivateKey(p)
46
+ diffieHellman.getPublicKeyFromPrivateKey(p);
58
47
  }).toThrow();
59
-
60
48
  });
61
49
 
62
50
  xtest('throws an error if private key is greater than the modulus parameter p', () => {
63
-
64
51
  expect(() => {
65
- diffieHellman.getPublicKeyFromPrivateKey(p + 1)
52
+ diffieHellman.getPublicKeyFromPrivateKey(p + 1);
66
53
  }).toThrow();
67
-
68
54
  });
69
55
 
70
56
  xtest('when given a private key, returns the correct public one', () => {
71
-
72
57
  expect(diffieHellman.getPublicKeyFromPrivateKey(alicePrivateKey)).toEqual(alicePublicKey);
73
-
74
58
  });
75
59
 
76
60
  xtest('when given a different private key, returns the correct public one', () => {
77
-
78
61
  expect(diffieHellman.getPublicKeyFromPrivateKey(bobPrivateKey)).toEqual(bobPublicKey);
79
-
80
62
  });
81
63
 
82
64
  xtest('can generate a shared secret from our private key and their public key', () => {
83
-
84
65
  const sharedSecret = 2;
85
66
 
86
67
  expect(diffieHellman.getSharedSecret(alicePrivateKey, bobPublicKey))
@@ -88,7 +69,5 @@ describe('diffie-hellman', () => {
88
69
 
89
70
  expect(diffieHellman.getSharedSecret(bobPrivateKey, alicePublicKey))
90
71
  .toEqual(sharedSecret);
91
-
92
72
  });
93
-
94
73
  });
@@ -1,23 +1,22 @@
1
1
  import transform from './etl';
2
2
 
3
3
  describe('Transform', () => {
4
-
5
4
  test('transforms one value', () => {
6
- const old = { 1: [ 'A' ] };
5
+ const old = { 1: ['A'] };
7
6
  const expected = { a: 1 };
8
7
 
9
8
  expect(transform(old)).toEqual(expected);
10
9
  });
11
10
 
12
11
  xtest('transforms more values', () => {
13
- const old = { 1: [ 'A', 'E', 'I', 'O', 'U' ] };
12
+ const old = { 1: ['A', 'E', 'I', 'O', 'U'] };
14
13
  const expected = { a: 1, e: 1, i: 1, o: 1, u: 1 };
15
14
 
16
15
  expect(transform(old)).toEqual(expected);
17
16
  });
18
17
 
19
18
  xtest('transforms more keys', () => {
20
- const old = { 1: [ 'A', 'E' ], 2: [ 'D', 'G' ] };
19
+ const old = { 1: ['A', 'E'], 2: ['D', 'G'] };
21
20
  const expected = { a: 1, e: 1, d: 2, g: 2 };
22
21
 
23
22
  expect(transform(old)).toEqual(expected);
@@ -25,24 +24,43 @@ describe('Transform', () => {
25
24
 
26
25
  xtest('transforms a full dataset', () => {
27
26
  const old = {
28
- 1: [ 'A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T' ],
29
- 2: [ 'D', 'G' ],
30
- 3: [ 'B', 'C', 'M', 'P' ],
31
- 4: [ 'F', 'H', 'V', 'W', 'Y' ],
32
- 5: [ 'K' ],
33
- 8: [ 'J', 'X' ],
34
- 10: [ 'Q', 'Z' ]
27
+ 1: ['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'],
28
+ 2: ['D', 'G'],
29
+ 3: ['B', 'C', 'M', 'P'],
30
+ 4: ['F', 'H', 'V', 'W', 'Y'],
31
+ 5: ['K'],
32
+ 8: ['J', 'X'],
33
+ 10: ['Q', 'Z'],
35
34
  };
36
35
  const expected = {
37
- a: 1, b: 3, c: 3, d: 2, e: 1,
38
- f: 4, g: 2, h: 4, i: 1, j: 8,
39
- k: 5, l: 1, m: 3, n: 1, o: 1,
40
- p: 3, q: 10, r: 1, s: 1, t: 1,
41
- u: 1, v: 4, w: 4, x: 8, y: 4,
42
- z: 10
36
+ a: 1,
37
+ b: 3,
38
+ c: 3,
39
+ d: 2,
40
+ e: 1,
41
+ f: 4,
42
+ g: 2,
43
+ h: 4,
44
+ i: 1,
45
+ j: 8,
46
+ k: 5,
47
+ l: 1,
48
+ m: 3,
49
+ n: 1,
50
+ o: 1,
51
+ p: 3,
52
+ q: 10,
53
+ r: 1,
54
+ s: 1,
55
+ t: 1,
56
+ u: 1,
57
+ v: 4,
58
+ w: 4,
59
+ x: 8,
60
+ y: 4,
61
+ z: 10,
43
62
  };
44
63
 
45
64
  expect(transform(old)).toEqual(expected);
46
65
  });
47
-
48
66
  });
@@ -1,11 +1,11 @@
1
1
  function transform(input) {
2
- let output = {};
2
+ const output = {};
3
3
 
4
4
  Object.keys(input).forEach((key) => {
5
- let items = input[key] || [];
5
+ const items = input[key] || [];
6
6
 
7
7
  items.forEach((item) => {
8
- let value = item.toLowerCase();
8
+ const value = item.toLowerCase();
9
9
  output[value] = Number(key);
10
10
  });
11
11
  });
@@ -6,6 +6,6 @@ export default class Flattener {
6
6
  ? acc.concat(this.flatten(el))
7
7
  : acc.concat(el),
8
8
  [])
9
- .filter(el => el !== null && el !== undefined)
9
+ .filter(el => el !== null && el !== undefined);
10
10
  }
11
11
  }
@@ -1,6 +1,6 @@
1
- import Flattener from "./flatten-array.js";
1
+ import Flattener from './flatten-array.js';
2
2
 
3
- describe("FlattenArray", () => {
3
+ describe('FlattenArray', () => {
4
4
  const flattener = new Flattener();
5
5
  test('flattens a nested list', () => {
6
6
  expect(flattener.flatten([[]])).toEqual([]);
@@ -37,5 +37,4 @@ describe("FlattenArray", () => {
37
37
  xtest('returns an empty list if all values in nested list are null', () => {
38
38
  expect(flattener.flatten([null, [[[null]]], null, null, [[null, null], null], null])).toEqual([]);
39
39
  });
40
-
41
40
  });
@@ -9,24 +9,24 @@ export default class Song {
9
9
  */
10
10
  verse(number) {
11
11
  switch (number) {
12
- case 1: return `I know an old lady who swallowed a fly.
12
+ case 1: return `I know an old lady who swallowed a fly.
13
13
  I don't know why she swallowed the fly. Perhaps she'll die.
14
14
  `;
15
15
 
16
- case 2: return `I know an old lady who swallowed a spider.
16
+ case 2: return `I know an old lady who swallowed a spider.
17
17
  It wriggled and jiggled and tickled inside her.
18
18
  She swallowed the spider to catch the fly.
19
19
  I don't know why she swallowed the fly. Perhaps she'll die.
20
20
  `;
21
21
 
22
- case 3: return `I know an old lady who swallowed a bird.
22
+ case 3: return `I know an old lady who swallowed a bird.
23
23
  How absurd to swallow a bird!
24
24
  She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
25
25
  She swallowed the spider to catch the fly.
26
26
  I don't know why she swallowed the fly. Perhaps she'll die.
27
27
  `;
28
28
 
29
- case 4: return `I know an old lady who swallowed a cat.
29
+ case 4: return `I know an old lady who swallowed a cat.
30
30
  Imagine that, to swallow a cat!
31
31
  She swallowed the cat to catch the bird.
32
32
  She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
@@ -34,7 +34,7 @@ She swallowed the spider to catch the fly.
34
34
  I don't know why she swallowed the fly. Perhaps she'll die.
35
35
  `;
36
36
 
37
- case 5: return `I know an old lady who swallowed a dog.
37
+ case 5: return `I know an old lady who swallowed a dog.
38
38
  What a hog, to swallow a dog!
39
39
  She swallowed the dog to catch the cat.
40
40
  She swallowed the cat to catch the bird.
@@ -43,7 +43,7 @@ She swallowed the spider to catch the fly.
43
43
  I don't know why she swallowed the fly. Perhaps she'll die.
44
44
  `;
45
45
 
46
- case 6: return `I know an old lady who swallowed a goat.
46
+ case 6: return `I know an old lady who swallowed a goat.
47
47
  Just opened her throat and swallowed a goat!
48
48
  She swallowed the goat to catch the dog.
49
49
  She swallowed the dog to catch the cat.
@@ -51,9 +51,9 @@ She swallowed the cat to catch the bird.
51
51
  She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
52
52
  She swallowed the spider to catch the fly.
53
53
  I don't know why she swallowed the fly. Perhaps she'll die.
54
- `;
54
+ `;
55
55
 
56
- case 7: return `I know an old lady who swallowed a cow.
56
+ case 7: return `I know an old lady who swallowed a cow.
57
57
  I don't know how she swallowed a cow!
58
58
  She swallowed the cow to catch the goat.
59
59
  She swallowed the goat to catch the dog.
@@ -64,7 +64,7 @@ She swallowed the spider to catch the fly.
64
64
  I don't know why she swallowed the fly. Perhaps she'll die.
65
65
  `;
66
66
 
67
- case 8: return `I know an old lady who swallowed a horse.
67
+ case 8: return `I know an old lady who swallowed a horse.
68
68
  She's dead, of course!
69
69
  `;
70
70
  }
@@ -81,11 +81,11 @@ She's dead, of course!
81
81
  * portion of song corresponding to requested verse number range (inclusive).
82
82
  */
83
83
  verses(first, last) {
84
- let rangeLength = last - first + 1;
85
- let sequence = Array.from({ length: rangeLength }, (v, k) => first + k); // integers from first to last
84
+ const rangeLength = last - first + 1;
85
+ const sequence = Array.from({ length: rangeLength }, (v, k) => first + k); // integers from first to last
86
86
 
87
87
  // build the final string
88
- let str = sequence.map(x => this.verse(x));
88
+ const str = sequence.map(x => this.verse(x));
89
89
  str.push('');
90
90
  return str.join('\n');
91
91
  }
@@ -168,6 +168,5 @@ She's dead, of course!
168
168
 
169
169
  expect(song.verses(1, 8)).toEqual(expected);
170
170
  });
171
-
172
171
  });
173
172
 
@@ -7,7 +7,7 @@ export default class Gigasecond {
7
7
  }
8
8
 
9
9
  date() {
10
- let birthTime = this.dateOfBirth.getTime();
10
+ const birthTime = this.dateOfBirth.getTime();
11
11
  return new Date(birthTime + GIGASECOND_IN_MILIS);
12
12
  }
13
13
 
@@ -1,7 +1,6 @@
1
1
  import Gigasecond from './gigasecond';
2
2
 
3
3
  describe('Gigasecond', () => {
4
-
5
4
  test('tells a gigasecond anniversary since midnight', () => {
6
5
  const gs = new Gigasecond(new Date(Date.UTC(2015, 8, 14)));
7
6
  const expectedDate = new Date(Date.UTC(2047, 4, 23, 1, 46, 40));
@@ -14,33 +14,33 @@ describe('School', () => {
14
14
  xtest('adding a student adds them to the roster for the given grade', () => {
15
15
  school.add('Aimee', 2);
16
16
 
17
- let expectedDb = { 2 : [ 'Aimee' ] };
17
+ const expectedDb = { 2: ['Aimee'] };
18
18
  expect(school.roster()).toEqual(expectedDb);
19
19
  });
20
20
 
21
21
  xtest('adding more students to the same grade adds them to the roster', () => {
22
- school.add('Blair',2);
23
- school.add('James',2);
24
- school.add('Paul',2);
22
+ school.add('Blair', 2);
23
+ school.add('James', 2);
24
+ school.add('Paul', 2);
25
25
 
26
- let expectedDb = { 2 : [ 'Blair', 'James', 'Paul' ] };
26
+ const expectedDb = { 2: ['Blair', 'James', 'Paul'] };
27
27
  expect(school.roster()).toEqual(expectedDb);
28
28
  });
29
29
 
30
30
  xtest('adding students to different grades adds them to the roster', () => {
31
- school.add('Chelsea',3);
32
- school.add('Logan',7);
31
+ school.add('Chelsea', 3);
32
+ school.add('Logan', 7);
33
33
 
34
- let expectedDb = { 3 : [ 'Chelsea' ], 7 : [ 'Logan'] };
34
+ const expectedDb = { 3: ['Chelsea'], 7: ['Logan'] };
35
35
  expect(school.roster()).toEqual(expectedDb);
36
36
  });
37
37
 
38
38
  xtest('grade returns the students in that grade in alphabetical order', () => {
39
- school.add('Franklin',5);
40
- school.add('Bradley',5);
41
- school.add('Jeff',1);
39
+ school.add('Franklin', 5);
40
+ school.add('Bradley', 5);
41
+ school.add('Jeff', 1);
42
42
 
43
- let expectedStudents = [ 'Bradley', 'Franklin' ];
43
+ const expectedStudents = ['Bradley', 'Franklin'];
44
44
  expect(school.grade(5)).toEqual(expectedStudents);
45
45
  });
46
46
 
@@ -54,10 +54,10 @@ describe('School', () => {
54
54
  school.add('Christopher', 4);
55
55
  school.add('Kyle', 3);
56
56
 
57
- let expectedSortedStudents = {
58
- 3 : ['Kyle'],
59
- 4 : ['Christopher', 'Jennifer'],
60
- 6 : ['Kareem']
57
+ const expectedSortedStudents = {
58
+ 3: ['Kyle'],
59
+ 4: ['Christopher', 'Jennifer'],
60
+ 6: ['Kareem'],
61
61
  };
62
62
  expect(school.roster()).toEqual(expectedSortedStudents);
63
63
  });
@@ -66,15 +66,14 @@ describe('School', () => {
66
66
  school.add('Aimee', 2);
67
67
  const roster = school.roster();
68
68
  roster[2].push('Oops.');
69
- const expectedDb = { 2 : [ 'Aimee' ] };
69
+ const expectedDb = { 2: ['Aimee'] };
70
70
  expect(school.roster()).toEqual(expectedDb);
71
71
  });
72
72
 
73
73
  xtest('roster cannot be modified outside of module using grade()', () => {
74
74
  school.add('Aimee', 2);
75
75
  school.grade(2).push('Oops.');
76
- const expectedDb = { 2 : [ 'Aimee' ] };
76
+ const expectedDb = { 2: ['Aimee'] };
77
77
  expect(school.roster()).toEqual(expectedDb);
78
78
  });
79
-
80
79
  });
@@ -63,5 +63,4 @@ describe('Grains', () => {
63
63
  xtest('total', () => {
64
64
  expect(grains.total()).toBe('18446744073709551615');
65
65
  });
66
-
67
66
  });
@@ -2,15 +2,15 @@
2
2
  class Hamming {
3
3
 
4
4
  compute(strand1, strand2) {
5
- let len1 = strand1.length;
6
- let len2 = strand2.length;
5
+ const len1 = strand1.length;
6
+ const len2 = strand2.length;
7
7
  if (len1 !== len2) {
8
8
  throw new Error('DNA strands must be of equal length.');
9
9
  }
10
10
 
11
11
  let distance = 0;
12
12
  let idx = -1;
13
- let end = len1; // there could be len2, they're equal
13
+ const end = len1; // there could be len2, they're equal
14
14
  while (++idx < end) {
15
15
  if (strand1[idx] !== strand2[idx]) {
16
16
  distance++;
@@ -1,22 +1,22 @@
1
1
  import Hamming from './hamming';
2
2
 
3
3
  describe('Hamming', () => {
4
- let hamming = new Hamming();
4
+ const hamming = new Hamming();
5
5
 
6
6
  test('no difference between identical strands', () => {
7
7
  expect(hamming.compute('A', 'A')).toEqual(0);
8
8
  });
9
9
 
10
10
  xtest('complete hamming distance for single nucleotide strand', () => {
11
- expect(hamming.compute('A','G')).toEqual(1);
11
+ expect(hamming.compute('A', 'G')).toEqual(1);
12
12
  });
13
13
 
14
14
  xtest('complete hamming distance for small strand', () => {
15
- expect(hamming.compute('AG','CT')).toEqual(2);
15
+ expect(hamming.compute('AG', 'CT')).toEqual(2);
16
16
  });
17
17
 
18
18
  xtest('small hamming distance', () => {
19
- expect(hamming.compute('AT','CT')).toEqual(1);
19
+ expect(hamming.compute('AT', 'CT')).toEqual(1);
20
20
  });
21
21
 
22
22
  xtest('small hamming distance in longer strand', () => {
@@ -33,8 +33,7 @@ describe('Hamming', () => {
33
33
 
34
34
  xtest('throws error when strands are not equal length', () => {
35
35
  expect(() => hamming.compute('GGACGGATTCTG', 'AGGAC')).toThrow(
36
- new Error('DNA strands must be of equal length.')
36
+ new Error('DNA strands must be of equal length.'),
37
37
  );
38
38
  });
39
-
40
39
  });
@@ -1,6 +1,6 @@
1
1
  class HelloWorld {
2
2
  hello() {
3
- return "Hello, World!";
3
+ return 'Hello, World!';
4
4
  }
5
5
  }
6
6
 
@@ -1,7 +1,7 @@
1
1
  import HelloWorld from './hello-world';
2
2
 
3
3
  describe('Hello World', () => {
4
- let greeter = new HelloWorld();
4
+ const greeter = new HelloWorld();
5
5
 
6
6
  test('says hello', () => {
7
7
  expect(greeter.hello()).toEqual('Hello, World!');
@@ -1,4 +1,4 @@
1
- export default function(hex) {
1
+ export default function (hex) {
2
2
  this.hex = hex;
3
3
 
4
4
  this.toDecimal = () => {
@@ -8,6 +8,6 @@ export default function(hex) {
8
8
  if (/[^0-9a-fA-F]/.exec(hexCharacters[i])) { return 0; }
9
9
  }
10
10
 
11
- return parseInt(this.hex,16);
11
+ return parseInt(this.hex, 16);
12
12
  };
13
13
  }