trackler 2.2.1.37 → 2.2.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/config.json +13 -13
  4. data/tracks/csharp/generators/Exercises/Clock.cs +19 -25
  5. data/tracks/javascript/.eslintrc.json +10 -0
  6. data/tracks/javascript/.travis.yml +1 -1
  7. data/tracks/javascript/README.md +10 -7
  8. data/tracks/javascript/big-integer.js +1 -1
  9. data/tracks/javascript/exercises/accumulate/accumulate.spec.js +12 -14
  10. data/tracks/javascript/exercises/acronym/acronym.spec.js +7 -7
  11. data/tracks/javascript/exercises/acronym/example.js +1 -1
  12. data/tracks/javascript/exercises/all-your-base/all-your-base.spec.js +0 -2
  13. data/tracks/javascript/exercises/allergies/allergies.spec.js +14 -15
  14. data/tracks/javascript/exercises/allergies/example.js +5 -5
  15. data/tracks/javascript/exercises/alphametics/alphametics.spec.js +56 -58
  16. data/tracks/javascript/exercises/alphametics/example.js +18 -18
  17. data/tracks/javascript/exercises/anagram/anagram.spec.js +12 -13
  18. data/tracks/javascript/exercises/anagram/example.js +1 -1
  19. data/tracks/javascript/exercises/atbash-cipher/atbash-cipher.spec.js +9 -11
  20. data/tracks/javascript/exercises/atbash-cipher/example.js +2 -2
  21. data/tracks/javascript/exercises/beer-song/beer-song.spec.js +7 -7
  22. data/tracks/javascript/exercises/beer-song/example.js +5 -5
  23. data/tracks/javascript/exercises/binary-search-tree/binary-search-tree.spec.js +10 -12
  24. data/tracks/javascript/exercises/binary-search-tree/example.js +4 -4
  25. data/tracks/javascript/exercises/binary-search/binary-search.spec.js +7 -8
  26. data/tracks/javascript/exercises/binary-search/example.js +5 -6
  27. data/tracks/javascript/exercises/binary/binary.spec.js +11 -12
  28. data/tracks/javascript/exercises/bob/bob.spec.js +0 -1
  29. data/tracks/javascript/exercises/bob/example.js +2 -3
  30. data/tracks/javascript/exercises/bowling/bowling.spec.js +48 -48
  31. data/tracks/javascript/exercises/bowling/example.js +3 -4
  32. data/tracks/javascript/exercises/bracket-push/bracket-push.spec.js +9 -9
  33. data/tracks/javascript/exercises/bracket-push/example.js +1 -1
  34. data/tracks/javascript/exercises/change/change.spec.js +36 -39
  35. data/tracks/javascript/exercises/change/example.js +129 -171
  36. data/tracks/javascript/exercises/circular-buffer/circular-buffer.spec.js +17 -19
  37. data/tracks/javascript/exercises/circular-buffer/example.js +48 -50
  38. data/tracks/javascript/exercises/clock/clock.spec.js +0 -8
  39. data/tracks/javascript/exercises/clock/example.js +1 -1
  40. data/tracks/javascript/exercises/crypto-square/crypto-square.spec.js +11 -11
  41. data/tracks/javascript/exercises/crypto-square/example.js +9 -9
  42. data/tracks/javascript/exercises/custom-set/custom-set.spec.js +41 -43
  43. data/tracks/javascript/exercises/custom-set/example-gen.js +27 -27
  44. data/tracks/javascript/exercises/custom-set/example.js +25 -26
  45. data/tracks/javascript/exercises/diamond/diamond.spec.js +19 -19
  46. data/tracks/javascript/exercises/diamond/example.js +18 -20
  47. data/tracks/javascript/exercises/difference-of-squares/difference-of-squares.spec.js +0 -5
  48. data/tracks/javascript/exercises/difference-of-squares/example.js +3 -3
  49. data/tracks/javascript/exercises/etl/etl.spec.js +5 -6
  50. data/tracks/javascript/exercises/etl/example.js +1 -1
  51. data/tracks/javascript/exercises/flatten-array/example.js +12 -12
  52. data/tracks/javascript/exercises/flatten-array/flatten-array.spec.js +15 -15
  53. data/tracks/javascript/exercises/food-chain/example.js +9 -9
  54. data/tracks/javascript/exercises/food-chain/food-chain.spec.js +1 -2
  55. data/tracks/javascript/exercises/gigasecond/example.js +1 -1
  56. data/tracks/javascript/exercises/gigasecond/gigasecond.spec.js +5 -6
  57. data/tracks/javascript/exercises/grade-school/example.js +2 -4
  58. data/tracks/javascript/exercises/grade-school/grade-school.spec.js +23 -24
  59. data/tracks/javascript/exercises/grains/big-integer.js +1 -1
  60. data/tracks/javascript/exercises/grains/big-integer.spec.js +10 -11
  61. data/tracks/javascript/exercises/grains/example.js +1 -1
  62. data/tracks/javascript/exercises/hamming/hamming.spec.js +5 -6
  63. data/tracks/javascript/exercises/hello-world/example.js +2 -2
  64. data/tracks/javascript/exercises/hello-world/hello-world.js +2 -2
  65. data/tracks/javascript/exercises/hello-world/hello-world.spec.js +2 -2
  66. data/tracks/javascript/exercises/hexadecimal/example.js +3 -3
  67. data/tracks/javascript/exercises/hexadecimal/hexadecimal.spec.js +12 -14
  68. data/tracks/javascript/exercises/isogram/example.js +2 -2
  69. data/tracks/javascript/exercises/isogram/isogram.spec.js +1 -2
  70. data/tracks/javascript/exercises/kindergarten-garden/example.js +4 -4
  71. data/tracks/javascript/exercises/kindergarten-garden/kindergarten-garden.spec.js +0 -5
  72. data/tracks/javascript/exercises/largest-series-product/example.js +4 -4
  73. data/tracks/javascript/exercises/largest-series-product/largest-series-product.spec.js +2 -4
  74. data/tracks/javascript/exercises/leap/example.js +1 -1
  75. data/tracks/javascript/exercises/leap/leap.js +2 -2
  76. data/tracks/javascript/exercises/leap/leap.spec.js +5 -9
  77. data/tracks/javascript/exercises/linked-list/example.js +5 -6
  78. data/tracks/javascript/exercises/linked-list/linked-list.spec.js +1 -1
  79. data/tracks/javascript/exercises/list-ops/example.js +3 -3
  80. data/tracks/javascript/exercises/list-ops/list-ops.spec.js +1 -1
  81. data/tracks/javascript/exercises/luhn/luhn.spec.js +1 -3
  82. data/tracks/javascript/exercises/matrix/example.js +1 -1
  83. data/tracks/javascript/exercises/matrix/matrix.spec.js +1 -3
  84. data/tracks/javascript/exercises/meetup/example.js +13 -15
  85. data/tracks/javascript/exercises/meetup/meetup.spec.js +16 -16
  86. data/tracks/javascript/exercises/minesweeper/example.js +19 -19
  87. data/tracks/javascript/exercises/minesweeper/minesweeper.spec.js +104 -106
  88. data/tracks/javascript/exercises/nth-prime/example.js +2 -2
  89. data/tracks/javascript/exercises/nth-prime/nth-prime.spec.js +7 -9
  90. data/tracks/javascript/exercises/nucleotide-count/nucleotide-count.spec.js +9 -11
  91. data/tracks/javascript/exercises/ocr-numbers/example.js +31 -31
  92. data/tracks/javascript/exercises/ocr-numbers/ocr-numbers.spec.js +0 -2
  93. data/tracks/javascript/exercises/octal/example.js +4 -4
  94. data/tracks/javascript/exercises/octal/octal.spec.js +11 -13
  95. data/tracks/javascript/exercises/palindrome-products/example.js +9 -10
  96. data/tracks/javascript/exercises/palindrome-products/palindrome-products.spec.js +7 -9
  97. data/tracks/javascript/exercises/pangram/example.js +1 -1
  98. data/tracks/javascript/exercises/pangram/pangram.spec.js +18 -20
  99. data/tracks/javascript/exercises/pascals-triangle/example.js +4 -4
  100. data/tracks/javascript/exercises/pascals-triangle/pascals-triangle.spec.js +1 -3
  101. data/tracks/javascript/exercises/perfect-numbers/example.js +7 -12
  102. data/tracks/javascript/exercises/perfect-numbers/perfect-numbers.spec.js +18 -28
  103. data/tracks/javascript/exercises/phone-number/example.js +13 -14
  104. data/tracks/javascript/exercises/phone-number/phone-number.spec.js +46 -46
  105. data/tracks/javascript/exercises/pig-latin/example.js +1 -1
  106. data/tracks/javascript/exercises/pig-latin/pig-latin.spec.js +0 -2
  107. data/tracks/javascript/exercises/point-mutations/example.js +1 -1
  108. data/tracks/javascript/exercises/point-mutations/point-mutations.spec.js +9 -11
  109. data/tracks/javascript/exercises/prime-factors/example.js +1 -1
  110. data/tracks/javascript/exercises/prime-factors/prime-factors.spec.js +12 -14
  111. data/tracks/javascript/exercises/proverb/example.js +13 -13
  112. data/tracks/javascript/exercises/proverb/proverb.spec.js +46 -46
  113. data/tracks/javascript/exercises/pythagorean-triplet/example.js +2 -2
  114. data/tracks/javascript/exercises/pythagorean-triplet/pythagorean-triplet.spec.js +0 -2
  115. data/tracks/javascript/exercises/queen-attack/example.js +5 -5
  116. data/tracks/javascript/exercises/queen-attack/queen-attack.spec.js +20 -22
  117. data/tracks/javascript/exercises/raindrops/example.js +2 -3
  118. data/tracks/javascript/exercises/raindrops/raindrops.spec.js +18 -19
  119. data/tracks/javascript/exercises/rna-transcription/example.js +6 -6
  120. data/tracks/javascript/exercises/rna-transcription/rna-transcription.spec.js +13 -14
  121. data/tracks/javascript/exercises/robot-name/example.js +8 -8
  122. data/tracks/javascript/exercises/robot-name/robot-name.spec.js +15 -15
  123. data/tracks/javascript/exercises/robot-simulator/example.js +19 -19
  124. data/tracks/javascript/exercises/robot-simulator/robot-simulator.spec.js +34 -34
  125. data/tracks/javascript/exercises/roman-numerals/example.js +14 -14
  126. data/tracks/javascript/exercises/roman-numerals/roman-numerals.spec.js +19 -19
  127. data/tracks/javascript/exercises/run-length-encoding/example.js +6 -6
  128. data/tracks/javascript/exercises/run-length-encoding/run-length-encoding.spec.js +36 -38
  129. data/tracks/javascript/exercises/saddle-points/example.js +6 -9
  130. data/tracks/javascript/exercises/saddle-points/saddle-points.spec.js +12 -12
  131. data/tracks/javascript/exercises/say/example.js +19 -21
  132. data/tracks/javascript/exercises/say/say.spec.js +1 -3
  133. data/tracks/javascript/exercises/scrabble-score/example.js +8 -8
  134. data/tracks/javascript/exercises/scrabble-score/scrabble-score.spec.js +7 -7
  135. data/tracks/javascript/exercises/secret-handshake/example.js +5 -6
  136. data/tracks/javascript/exercises/secret-handshake/secret-handshake.spec.js +12 -12
  137. data/tracks/javascript/exercises/series/example.js +3 -3
  138. data/tracks/javascript/exercises/series/series.spec.js +1 -3
  139. data/tracks/javascript/exercises/sieve/example.js +1 -1
  140. data/tracks/javascript/exercises/sieve/sieve.spec.js +4 -6
  141. data/tracks/javascript/exercises/simple-cipher/example.js +4 -5
  142. data/tracks/javascript/exercises/simple-cipher/simple-cipher.spec.js +1 -1
  143. data/tracks/javascript/exercises/simple-linked-list/example.js +4 -5
  144. data/tracks/javascript/exercises/simple-linked-list/simple-linked-list.spec.js +0 -5
  145. data/tracks/javascript/exercises/space-age/example.js +17 -17
  146. data/tracks/javascript/exercises/space-age/space-age.spec.js +10 -10
  147. data/tracks/javascript/exercises/strain/example.js +2 -2
  148. data/tracks/javascript/exercises/strain/strain.spec.js +25 -27
  149. data/tracks/javascript/exercises/sublist/example.js +15 -15
  150. data/tracks/javascript/exercises/sublist/sublist.spec.js +18 -21
  151. data/tracks/javascript/exercises/sum-of-multiples/example.js +1 -1
  152. data/tracks/javascript/exercises/triangle/example.js +8 -8
  153. data/tracks/javascript/exercises/triangle/triangle.spec.js +33 -35
  154. data/tracks/javascript/exercises/trinary/example.js +2 -2
  155. data/tracks/javascript/exercises/trinary/trinary.spec.js +9 -11
  156. data/tracks/javascript/exercises/two-bucket/example.js +29 -29
  157. data/tracks/javascript/exercises/two-bucket/two-bucket.spec.js +15 -15
  158. data/tracks/javascript/exercises/word-count/example.js +3 -3
  159. data/tracks/javascript/exercises/word-count/word-count.spec.js +16 -16
  160. data/tracks/javascript/exercises/wordy/example.js +9 -9
  161. data/tracks/javascript/exercises/wordy/wordy.spec.js +17 -19
  162. data/tracks/javascript/package-lock.json +1842 -0
  163. data/tracks/javascript/package.json +22 -0
  164. data/tracks/julia/README.md +15 -7
  165. data/tracks/julia/config.json +10 -0
  166. data/tracks/julia/exercises/robot-simulator/README.md +35 -0
  167. data/tracks/julia/exercises/robot-simulator/example.jl +53 -0
  168. data/tracks/julia/exercises/robot-simulator/robot-simulator.jl +0 -0
  169. data/tracks/julia/exercises/robot-simulator/runtests.jl +73 -0
  170. data/tracks/julia/exercises/rotational-cipher/example.jl +3 -1
  171. data/tracks/julia/runtests.jl +5 -3
  172. data/tracks/purescript/.gitignore +2 -0
  173. data/tracks/purescript/.travis.yml +1 -2
  174. data/tracks/purescript/bin/test.sh +60 -19
  175. data/tracks/purescript/bin/update-bower.sh +25 -0
  176. data/tracks/purescript/etc/bower.json +26 -0
  177. data/tracks/purescript/etc/test-main-maker.js +48 -0
  178. data/tracks/purescript/etc/test-module-updater.js +20 -0
  179. data/tracks/purescript/exercises/accumulate/bower.json +12 -2
  180. data/tracks/purescript/exercises/accumulate/test/Main.purs +15 -4
  181. data/tracks/purescript/exercises/acronym/bower.json +11 -2
  182. data/tracks/purescript/exercises/acronym/test/Main.purs +14 -3
  183. data/tracks/purescript/exercises/all-your-base/bower.json +12 -2
  184. data/tracks/purescript/exercises/all-your-base/test/Main.purs +15 -3
  185. data/tracks/purescript/exercises/allergies/bower.json +12 -4
  186. data/tracks/purescript/exercises/allergies/test/Main.purs +15 -5
  187. data/tracks/purescript/exercises/atbash-cipher/bower.json +11 -3
  188. data/tracks/purescript/exercises/atbash-cipher/test/Main.purs +15 -4
  189. data/tracks/purescript/exercises/binary-search/bower.json +12 -2
  190. data/tracks/purescript/exercises/binary-search/test/Main.purs +15 -3
  191. data/tracks/purescript/exercises/bob/bower.json +12 -3
  192. data/tracks/purescript/exercises/bob/examples/src/Bob.purs +1 -1
  193. data/tracks/purescript/exercises/bob/test/Main.purs +16 -3
  194. data/tracks/purescript/exercises/bracket-push/bower.json +12 -3
  195. data/tracks/purescript/exercises/bracket-push/test/Main.purs +15 -3
  196. data/tracks/purescript/exercises/crypto-square/bower.json +11 -3
  197. data/tracks/purescript/exercises/crypto-square/test/Main.purs +15 -4
  198. data/tracks/purescript/exercises/diamond/bower.json +12 -3
  199. data/tracks/purescript/exercises/diamond/test/Main.purs +15 -4
  200. data/tracks/purescript/exercises/difference-of-squares/bower.json +12 -2
  201. data/tracks/purescript/exercises/difference-of-squares/test/Main.purs +15 -4
  202. data/tracks/purescript/exercises/etl/bower.json +12 -3
  203. data/tracks/purescript/exercises/etl/test/Main.purs +15 -4
  204. data/tracks/purescript/exercises/hamming/bower.json +12 -2
  205. data/tracks/purescript/exercises/hamming/test/Main.purs +16 -5
  206. data/tracks/purescript/exercises/hello-world/bower.json +12 -3
  207. data/tracks/purescript/exercises/hello-world/test/Main.purs +15 -2
  208. data/tracks/purescript/exercises/isogram/bower.json +12 -4
  209. data/tracks/purescript/exercises/isogram/test/Main.purs +15 -3
  210. data/tracks/purescript/exercises/largest-series-product/bower.json +12 -2
  211. data/tracks/purescript/exercises/largest-series-product/test/Main.purs +15 -3
  212. data/tracks/purescript/exercises/leap/bower.json +12 -2
  213. data/tracks/purescript/exercises/leap/test/Main.purs +15 -2
  214. data/tracks/purescript/exercises/meetup/bower.json +12 -3
  215. data/tracks/purescript/exercises/meetup/test/Main.purs +15 -3
  216. data/tracks/purescript/exercises/pangram/bower.json +12 -3
  217. data/tracks/purescript/exercises/pangram/test/Main.purs +16 -3
  218. data/tracks/purescript/exercises/pascals-triangle/bower.json +14 -4
  219. data/tracks/purescript/exercises/pascals-triangle/test/Main.purs +12 -7
  220. data/tracks/purescript/exercises/raindrops/bower.json +12 -2
  221. data/tracks/purescript/exercises/raindrops/test/Main.purs +15 -2
  222. data/tracks/purescript/exercises/scrabble-score/bower.json +12 -2
  223. data/tracks/purescript/exercises/scrabble-score/test/Main.purs +15 -4
  224. data/tracks/purescript/exercises/triangle/bower.json +11 -4
  225. data/tracks/purescript/exercises/triangle/test/Main.purs +14 -3
  226. data/tracks/purescript/exercises/word-count/bower.json +12 -3
  227. data/tracks/purescript/exercises/word-count/test/Main.purs +15 -3
  228. data/tracks/sml/README.md +125 -5
  229. data/tracks/sml/config.json +1 -0
  230. data/tracks/sml/docs/INSTALLATION.md +2 -2
  231. metadata +13 -4
  232. data/tracks/purescript/bin/test-one.sh +0 -58
  233. data/tracks/sml/SETUP.md +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad84e4a8d88075679edfbdd19d33960379abd6b9
4
- data.tar.gz: 6b2b8da9a950f3e6a8a20519e03b34714e151916
3
+ metadata.gz: ef25f03125cc9c370682667a477e6ae6ff3e1192
4
+ data.tar.gz: 6455fca063d946a90a3dcfe79d83b3fbd4a6968d
5
5
  SHA512:
6
- metadata.gz: b2e29119464f07bbfc8eef01b406fbac92996900385f5f86754093749a56c6703e501487bf1f65e080ad04c2e4be2c43b1cd3fe45fd9d6d0690438bb19e9f497
7
- data.tar.gz: 5189f5e61c75cfdfe895602c768aa10ee3f694f71a9ac3847e6c408a8fbc79ad5f527b6d8d266df6b4ab6af69b5affa3b02a483035219c6d169bea1f2701bbff
6
+ metadata.gz: 1bebd2177492ef8d658e77760fc46d6b44f98d50e7ed384665de50e26b1c71d3b2448657290900a98bed2927189241a0eb46339c4ce57626bd8a8ad32fb12e31
7
+ data.tar.gz: 4c2cbc31eded51c388e7759052d5a15547966263ff8c5e2cbcedecdbb3c4cc92cc94ddc6029eac7f15b6e22b734bdd0289bfa447007ab5ea4df2530b97fa2216
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.37"
2
+ VERSION = "2.2.1.38"
3
3
  end
@@ -26,19 +26,6 @@
26
26
  "control-flow (loops)"
27
27
  ]
28
28
  },
29
- {
30
- "uuid": "82b19968-03f9-4e17-b729-db6c3e2abfa4",
31
- "slug": "anagram",
32
- "core": false,
33
- "unlocked_by": "acronym",
34
- "difficulty": 5,
35
- "topics": [
36
- "strings",
37
- "filtering",
38
- "structs",
39
- "memory management"
40
- ]
41
- },
42
29
  {
43
30
  "uuid": "24721f7a-4123-470f-81e2-a252e56f3ceb",
44
31
  "slug": "leap",
@@ -256,6 +243,19 @@
256
243
  "memory management"
257
244
  ]
258
245
  },
246
+ {
247
+ "uuid": "82b19968-03f9-4e17-b729-db6c3e2abfa4",
248
+ "slug": "anagram",
249
+ "core": false,
250
+ "unlocked_by": "acronym",
251
+ "difficulty": 5,
252
+ "topics": [
253
+ "strings",
254
+ "filtering",
255
+ "structs",
256
+ "memory management"
257
+ ]
258
+ },
259
259
  {
260
260
  "uuid": "e39c4445-eadd-4bcf-9b49-2256ed38d6fd",
261
261
  "slug": "atbash-cipher",
@@ -1,61 +1,55 @@
1
1
  using System.Collections.Generic;
2
2
  using Generators.Input;
3
3
  using Generators.Output;
4
- using Newtonsoft.Json.Linq;
5
4
 
6
5
  namespace Generators.Exercises
7
6
  {
8
7
  public class Clock : Exercise
9
8
  {
10
- private const string paramClock1 = "clock1";
11
- private const string paramClock2 = "clock2";
12
- private const string paramHour = "hour";
13
- private const string paramMinute = "minute";
9
+ private const string ParamClock1 = "clock1";
10
+ private const string ParamClock2 = "clock2";
11
+ private const string ParamHour = "hour";
12
+ private const string ParamMinute = "minute";
14
13
 
15
- private const string propertyCreate = "create";
16
- private const string propertyEqual = "equal";
17
- private const string propertyEquals = "equals";
18
- private const string propertyToString = "to_string";
14
+ private const string PropertyCreate = "create";
15
+ private const string PropertyEqual = "equal";
16
+ private const string PropertyEquals = "equals";
17
+ private const string PropertyToString = "to_string";
19
18
 
20
19
  protected override void UpdateCanonicalData(CanonicalData canonicalData)
21
20
  {
22
21
  foreach (var canonicalDataCase in canonicalData.Cases)
23
22
  {
24
- if (canonicalDataCase.Property != propertyEqual)
23
+ if (canonicalDataCase.Property != PropertyEqual)
25
24
  {
26
- canonicalDataCase.ConstructorInput = new Dictionary<string, object>
27
- {
28
- [paramHour] = canonicalDataCase.Input[paramHour],
29
- [paramMinute] = canonicalDataCase.Input[paramMinute]
30
- };
25
+ canonicalDataCase.SetConstructorInputParameters(ParamHour, ParamMinute);
31
26
  }
32
27
  else
33
28
  {
34
- canonicalDataCase.ConstructorInput = ((JObject)canonicalDataCase.Input[paramClock1]).ToObject<Dictionary<string, object>>();
35
- canonicalDataCase.Input.Remove(paramClock1);
29
+ canonicalDataCase.SetConstructorInputParameters(ParamClock1);
36
30
 
37
- var result = ((JObject)canonicalDataCase.Input[paramClock2]).ToObject<Dictionary<string, object>>();
38
- canonicalDataCase.Input[paramClock2] = new UnescapedValue($"new Clock({result[paramHour]}, {result[paramMinute]})");
31
+ var result = (Dictionary<string, object>)canonicalDataCase.Properties[ParamClock2];
32
+ canonicalDataCase.Properties[ParamClock2] = new UnescapedValue($"new Clock({result[ParamHour]}, {result[ParamMinute]})");
39
33
  }
40
34
 
41
- if (canonicalDataCase.Property == propertyCreate)
35
+ if (canonicalDataCase.Property == PropertyCreate)
42
36
  {
43
- canonicalDataCase.Property = propertyToString;
37
+ canonicalDataCase.Property = PropertyToString;
44
38
  }
45
- else if (canonicalDataCase.Property == propertyEqual)
39
+ else if (canonicalDataCase.Property == PropertyEqual)
46
40
  {
47
- canonicalDataCase.Property = propertyEquals;
41
+ canonicalDataCase.Property = PropertyEquals;
48
42
  }
49
43
  }
50
44
  }
51
45
 
52
46
  protected override string RenderTestMethodBodyAssert(TestMethodBody testMethodBody)
53
47
  {
54
- if (testMethodBody.CanonicalDataCase.Property == propertyEquals)
48
+ if (testMethodBody.CanonicalDataCase.Property == PropertyEquals)
55
49
  {
56
50
  return base.RenderTestMethodBodyAssert(testMethodBody);
57
51
  }
58
- else if (testMethodBody.CanonicalDataCase.Property != propertyToString)
52
+ else if (testMethodBody.CanonicalDataCase.Property != PropertyToString)
59
53
  {
60
54
  return RenderConsistencyToAssert(testMethodBody);
61
55
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "plugins": ["jasmine"],
3
+ "extends": "eslint-config-airbnb-es5",
4
+ "env": {
5
+ "jasmine": true
6
+ },
7
+ "rules": {
8
+ "func-names": "off"
9
+ }
10
+ }
@@ -3,7 +3,7 @@ language: node_js
3
3
  sudo: false
4
4
 
5
5
  node_js:
6
- - 5.7
6
+ - "node"
7
7
 
8
8
  install:
9
9
  - "npm install -g jasmine"
@@ -6,20 +6,23 @@ Exercism exercises in JavaScript
6
6
 
7
7
  To run the tests, you'll need NodeJS and Jasmine. For information about how to install these tools, see the [Javascript](http://exercism.io/languages/javascript/about) page.
8
8
 
9
- ## Running Unit Test Suite
9
+ ## Tasks
10
10
 
11
- The following commands assume that you are in the 'javascript' directory:
11
+ The following commands assume that you are in the `javascript` directory:
12
12
 
13
- ### All Assignments
13
+ ### Unit Tests: All Assignments
14
14
 
15
- % make test
15
+ make test
16
16
 
17
- ### Single Assignment
17
+ ### Unit Tests: Single Assignment
18
18
 
19
- % make test-assignment ASSIGNMENT=wordy
19
+ make test-assignment ASSIGNMENT=wordy
20
+
21
+ ### Code Style
22
+
23
+ npm run lint
20
24
 
21
25
  ## Contributing Guide
22
26
 
23
27
  Please see the [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
24
28
 
25
-
@@ -1 +1 @@
1
- var bigInt=function(e){"use strict";function o(e,t){this.value=e,this.sign=t,this.isSmall=!1}function u(e){this.value=e,this.sign=e<0,this.isSmall=!0}function a(e){return-r<e&&e<r}function f(e){return e<1e7?[e]:e<1e14?[e%1e7,Math.floor(e/1e7)]:[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function l(e){c(e);var n=e.length;if(n<4&&A(e,i)<0)switch(n){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*t;default:return e[0]+(e[1]+e[2]*t)*t}return e}function c(e){var t=e.length;while(e[--t]===0);e.length=t+1}function h(e){var t=new Array(e),n=-1;while(++n<e)t[n]=0;return t}function p(e){return e>0?Math.floor(e):Math.ceil(e)}function d(e,n){var r=e.length,i=n.length,s=new Array(r),o=0,u=t,a,f;for(f=0;f<i;f++)a=e[f]+n[f]+o,o=a>=u?1:0,s[f]=a-o*u;while(f<r)a=e[f]+o,o=a===u?1:0,s[f++]=a-o*u;return o>0&&s.push(o),s}function v(e,t){return e.length>=t.length?d(e,t):d(t,e)}function m(e,n){var r=e.length,i=new Array(r),s=t,o,u;for(u=0;u<r;u++)o=e[u]-s+n,n=Math.floor(o/s),i[u]=o-n*s,n+=1;while(n>0)i[u++]=n%s,n=Math.floor(n/s);return i}function g(e,n){var r=e.length,i=n.length,s=new Array(r),o=0,u=t,a,f;for(a=0;a<i;a++)f=e[a]-o-n[a],f<0?(f+=u,o=1):o=0,s[a]=f;for(a=i;a<r;a++){f=e[a]-o;if(!(f<0)){s[a++]=f;break}f+=u,s[a]=f}for(;a<r;a++)s[a]=e[a];return c(s),s}function y(e,t,n){var r,i;return A(e,t)>=0?r=g(e,t):(r=g(t,e),n=!n),r=l(r),typeof r=="number"?(n&&(r=-r),new u(r)):new o(r,n)}function b(e,n,r){var i=e.length,s=new Array(i),a=-n,f=t,c,h;for(c=0;c<i;c++)h=e[c]+a,a=Math.floor(h/f),s[c]=h<0?h%f+f:h;return s=l(s),typeof s=="number"?(r&&(s=-s),new u(s)):new o(s,r)}function w(e,n){var r=e.length,i=n.length,s=r+i,o=h(s),u=t,a,f,l,p,d;for(l=0;l<r;++l){p=e[l];for(var v=0;v<i;++v)d=n[v],a=p*d+o[l+v],f=Math.floor(a/u),o[l+v]=a-f*u,o[l+v+1]+=f}return c(o),o}function E(e,n){var r=e.length,i=new Array(r),s=t,o=0,u,a;for(a=0;a<r;a++)u=e[a]*n+o,o=Math.floor(u/s),i[a]=u-o*s;while(o>0)i[a++]=o%s,o=Math.floor(o/s);return i}function S(e,t){var n=[];while(t-->0)n.push(0);return n.concat(e)}function x(e,t){var n=Math.max(e.length,t.length);if(n<=400)return w(e,t);n=Math.ceil(n/2);var r=e.slice(n),i=e.slice(0,n),s=t.slice(n),o=t.slice(0,n),u=x(i,o),a=x(r,s),f=x(v(i,r),v(o,s));return v(v(u,S(g(g(f,u),a),n)),S(a,2*n))}function T(e){var n=e.length,r=h(n+n),i=t,s,o,u,a,f;for(u=0;u<n;u++){a=e[u];for(var l=0;l<n;l++)f=e[l],s=a*f+r[u+l],o=Math.floor(s/i),r[u+l]=s-o*i,r[u+l+1]+=o}return c(r),r}function N(e,n){var r=e.length,i=n.length,s=t,o=h(n.length),u=n[i-1],a=Math.ceil(s/(2*u)),f=E(e,a),c=E(n,a),p,d,v,m,g,y,b;f.length<=r&&f.push(0),c.push(0),u=c[i-1];for(d=r-i;d>=0;d--){p=s-1,p=Math.floor((f[d+i]*s+f[d+i-1])/u),v=0,m=0,y=c.length;for(g=0;g<y;g++)v+=p*c[g],b=Math.floor(v/s),m+=f[d+g]-(v-b*s),v=b,m<0?(f[d+g]=m+s,m=-1):(f[d+g]=m,m=0);while(m!==0){p-=1,v=0;for(g=0;g<y;g++)v+=f[d+g]-s+c[g],v<0?(f[d+g]=v+s,v=0):(f[d+g]=v,v=1);m+=v}o[d]=p}return f=k(f,a)[0],[l(o),l(f)]}function C(e,n){var r=e.length,i=n.length,s=[],o=[],u=t,a,f,c,h,p;while(r){o.unshift(e[--r]);if(A(o,n)<0){s.push(0);continue}f=o.length,c=o[f-1]*u+o[f-2],h=n[i-1]*u+n[i-2],f>i&&(c=(c+1)*u),a=Math.ceil(c/h);do{p=E(n,a);if(A(p,o)<=0)break;a--}while(a);s.push(a),o=g(o,p)}return s.reverse(),[l(s),l(o)]}function k(e,n){var r=e.length,i=h(r),s=t,o,u,a,f;a=0;for(o=r-1;o>=0;--o)f=a*s+e[o],u=p(f/n),a=f-u*n,i[o]=u|0;return[i,a|0]}function L(e,n){var r,i=z(n),s=e.value,a=i.value,c;if(a===0)throw new Error("Cannot divide by zero");if(e.isSmall)return i.isSmall?[new u(p(s/a)),new u(s%a)]:[W[0],e];if(i.isSmall){if(a===1)return[e,W[0]];if(a==-1)return[e.negate(),W[0]];var h=Math.abs(a);if(h<t){r=k(s,h),c=l(r[0]);var d=r[1];return e.sign&&(d=-d),typeof c=="number"?(e.sign!==i.sign&&(c=-c),[new u(c),new u(d)]):[new o(c,e.sign!==i.sign),new u(d)]}a=f(h)}var v=A(s,a);if(v===-1)return[W[0],e];if(v===0)return[W[e.sign===i.sign?1:-1],W[0]];s.length+a.length<=200?r=N(s,a):r=C(s,a),c=r[0];var m=e.sign!==i.sign,g=r[1],y=e.sign;return typeof c=="number"?(m&&(c=-c),c=new u(c)):c=new o(c,m),typeof g=="number"?(y&&(g=-g),g=new u(g)):g=new o(g,y),[c,g]}function A(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return e[n]>t[n]?1:-1;return 0}function D(e){return(typeof e=="number"||typeof e=="string")&&+Math.abs(e)<=t||e instanceof o&&e.value.length<=1}function P(e,t,n){t=z(t);var r=e.isNegative(),i=t.isNegative(),s=r?e.not():e,o=i?t.not():t,u=[],a=[],f=!1,l=!1;while(!f||!l)s.isZero()?(f=!0,u.push(r?1:0)):r?u.push(s.isEven()?1:0):u.push(s.isEven()?0:1),o.isZero()?(l=!0,a.push(i?1:0)):i?a.push(o.isEven()?1:0):a.push(o.isEven()?0:1),s=s.over(2),o=o.over(2);var c=[];for(var h=0;h<u.length;h++)c.push(n(u[h],a[h]));var p=bigInt(c.pop()).negate().times(bigInt(2).pow(c.length));while(c.length)p=p.add(bigInt(c.pop()).times(bigInt(2).pow(c.length)));return p}function H(e,t){return e=z(e),t=z(t),e.greater(t)?e:t}function B(e,t){return e=z(e),t=z(t),e.lesser(t)?e:t}function j(e,t){return e=z(e).abs(),t=z(t).abs(),e.equals(t)?e:e.isZero()?t:t.isZero()?e:e.isEven()?t.isOdd()?j(e.divide(2),t):j(e.divide(2),t.divide(2)).multiply(2):t.isEven()?j(e,t.divide(2)):e.greater(t)?j(e.subtract(t).divide(2),t):j(t.subtract(e).divide(2),e)}function F(e,t){return e=z(e).abs(),t=z(t).abs(),e.multiply(t).divide(j(e,t))}function I(e,n){e=z(e),n=z(n);var r=B(e,n),i=H(e,n),s=i.subtract(r);if(s.isSmall)return r.add(Math.random()*s);var u=s.value.length-1,a=[],f=!0;for(var c=u;c>=0;c--){var h=f?s.value[c]:t,d=p(Math.random()*h);a.unshift(d),d<h&&(f=!1)}return a=l(a),r.add(new o(a,!1,typeof a=="number"))}function R(e){var t=e.value;return typeof t=="number"&&(t=[t]),t.length===1&&t[0]<=36?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t[0]):"<"+t+">"}function U(e,t){t=bigInt(t);if(t.isZero()){if(e.isZero())return"0";throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1))return e.isZero()?"0":e.isNegative()?(new Array(1-e)).join("10"):"1"+(new Array(+e)).join("01");var n="";e.isNegative()&&t.isPositive()&&(n="-",e=e.abs());if(t.equals(1))return e.isZero()?"0":n+(new Array(+e+1)).join(1);var r=[],i=e,s;while(i.isNegative()||i.compareAbs(t)>=0){s=i.divmod(t),i=s.quotient;var o=s.remainder;o.isNegative()&&(o=t.minus(o).abs(),i=i.next()),r.push(R(o))}return r.push(R(i)),n+r.reverse().join("")}function z(e){if(e instanceof o||e instanceof u)return e;if(typeof e=="number"){if(a(e))return new u(e);e=String(e)}if(typeof e=="string"){if(a(+e)){var t=+e;if(t===p(t))return new u(t);throw"Invalid integer: "+e}var r=e[0]==="-";r&&(e=e.slice(1));var i=e.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+f.join("e"));if(i.length===2){var s=i[1];s[0]==="+"&&(s=s.slice(1)),s=+s;if(s!==p(s)||!a(s))throw new Error("Invalid integer: "+s+" is not a valid exponent.");var f=i[0],l=f.indexOf(".");l>=0&&(s-=f.length-l,f=f.slice(0,l)+f.slice(l+1));if(s<0)throw new Error("Cannot include negative exponent part for integers");f+=(new Array(s+1)).join("0"),e=f}var h=/^([0-9][0-9]*)$/.test(e);if(!h)throw new Error("Invalid integer: "+e);var d=[],v=e.length,m=n,g=v-m;while(v>0)d.push(+e.slice(g,v)),g-=m,g<0&&(g=0),v-=m;return c(d),new o(d,r)}}var t=1e7,n=7,r=9007199254740992,i=f(r),s=Math.log(r);o.prototype.add=function(e){var t,n=z(e);if(this.sign!==n.sign)return this.subtract(n.negate());var r=this.value,i=n.value;return n.isSmall?new o(m(r,Math.abs(i)),this.sign):new o(v(r,i),this.sign)},o.prototype.plus=o.prototype.add,u.prototype.add=function(e){var t=z(e),n=this.value;if(n<0!==t.sign)return this.subtract(t.negate());var r=t.value;if(t.isSmall){if(a(n+r))return new u(n+r);r=f(Math.abs(r))}return new o(m(r,Math.abs(n)),n<0)},u.prototype.plus=u.prototype.add,o.prototype.subtract=function(e){var t=z(e);if(this.sign!==t.sign)return this.add(t.negate());var n=this.value,r=t.value;return t.isSmall?b(n,Math.abs(r),this.sign):y(n,r,this.sign)},o.prototype.minus=o.prototype.subtract,u.prototype.subtract=function(e){var t=z(e),n=this.value;if(n<0!==t.sign)return this.add(t.negate());var r=t.value;return t.isSmall?new u(n-r):b(r,Math.abs(n),n>=0)},u.prototype.minus=u.prototype.subtract,o.prototype.negate=function(){return new o(this.value,!this.sign)},u.prototype.negate=function(){var e=this.sign,t=new u(-this.value);return t.sign=!e,t},o.prototype.abs=function(){return new o(this.value,!1)},u.prototype.abs=function(){return new u(Math.abs(this.value))},o.prototype.multiply=function(e){var n,r=z(e),i=this.value,s=r.value,u=this.sign!==r.sign,a;if(r.isSmall){if(s===0)return W[0];if(s===1)return this;if(s===-1)return this.negate();a=Math.abs(s);if(a<t)return new o(E(i,a),u);s=f(a)}return i.length+s.length>4e3?new o(x(i,s),u):new o(w(i,s),u)},o.prototype.times=o.prototype.multiply,u.prototype.multiply=function(e){var n=z(e),r=this.value,i=n.value;if(r===0)return W[0];if(r===1)return n;if(r===-1)return n.negate();if(n.isSmall){if(a(r*i))return new u(r*i);i=f(Math.abs(i))}var s=Math.abs(r);return s<t?new o(E(i,s),this.sign!==n.sign):new o(w(i,f(s)),this.sign!==n.sign)},u.prototype.times=u.prototype.multiply,o.prototype.square=function(){return new o(T(this.value),!1)},u.prototype.square=function(){var e=this.value*this.value;return a(e)?new u(e):new o(T(f(Math.abs(this.value))),!1)},o.prototype.divmod=function(e){var t=L(this,e);return{quotient:t[0],remainder:t[1]}},u.prototype.divmod=o.prototype.divmod,o.prototype.divide=function(e){return L(this,e)[0]},u.prototype.over=u.prototype.divide=o.prototype.over=o.prototype.divide,o.prototype.mod=function(e){return L(this,e)[1]},u.prototype.remainder=u.prototype.mod=o.prototype.remainder=o.prototype.mod,o.prototype.pow=function(e){var t=z(e),n=this.value,r=t.value,i,s,o;if(r===0)return W[1];if(n===0)return W[0];if(n===1)return W[1];if(n===-1)return t.isEven()?W[1]:W[-1];if(t.sign)return W[0];if(!t.isSmall)throw new Error("The exponent "+t.toString()+" is too large.");if(this.isSmall&&a(i=Math.pow(n,r)))return new u(p(i));s=this,o=W[1];for(;;){r&!0&&(o=o.times(s),--r);if(r===0)break;r/=2,s=s.square()}return o},u.prototype.pow=o.prototype.pow,o.prototype.modPow=function(e,t){e=z(e),t=z(t);if(t.isZero())throw new Error("Cannot take modPow with modulus 0");var n=W[1],r=this.mod(t);if(r.isZero())return W[0];while(e.isPositive())e.isOdd()&&(n=n.multiply(r).mod(t)),e=e.divide(2),r=r.square().mod(t);return n},u.prototype.modPow=o.prototype.modPow,o.prototype.compareAbs=function(e){var t=z(e),n=this.value,r=t.value;return t.isSmall?1:A(n,r)},u.prototype.compareAbs=function(e){var t=z(e),n=Math.abs(this.value),r=t.value;return t.isSmall?(r=Math.abs(r),n===r?0:n>r?1:-1):-1},o.prototype.compare=function(e){var t=z(e),n=this.value,r=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:A(n,r)*(this.sign?-1:1)},o.prototype.compareTo=o.prototype.compare,u.prototype.compare=function(e){var t=z(e),n=this.value,r=t.value;return t.isSmall?n==r?0:n>r?1:-1:n<0!==t.sign?n<0?-1:1:n<0?1:-1},u.prototype.compareTo=u.prototype.compare,o.prototype.equals=function(e){return this.compare(e)===0},u.prototype.eq=u.prototype.equals=o.prototype.eq=o.prototype.equals,o.prototype.notEquals=function(e){return this.compare(e)!==0},u.prototype.neq=u.prototype.notEquals=o.prototype.neq=o.prototype.notEquals,o.prototype.greater=function(e){return this.compare(e)>0},u.prototype.gt=u.prototype.greater=o.prototype.gt=o.prototype.greater,o.prototype.lesser=function(e){return this.compare(e)<0},u.prototype.lt=u.prototype.lesser=o.prototype.lt=o.prototype.lesser,o.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},u.prototype.geq=u.prototype.greaterOrEquals=o.prototype.geq=o.prototype.greaterOrEquals,o.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},u.prototype.leq=u.prototype.lesserOrEquals=o.prototype.leq=o.prototype.lesserOrEquals,o.prototype.isEven=function(){return(this.value[0]&1)===0},u.prototype.isEven=function(){return(this.value&1)===0},o.prototype.isOdd=function(){return(this.value[0]&1)===1},u.prototype.isOdd=function(){return(this.value&1)===1},o.prototype.isPositive=function(){return!this.sign},u.prototype.isPositive=function(){return this.value>0},o.prototype.isNegative=function(){return this.sign},u.prototype.isNegative=function(){return this.value<0},o.prototype.isUnit=function(){return!1},u.prototype.isUnit=function(){return Math.abs(this.value)===1},o.prototype.isZero=function(){return!1},u.prototype.isZero=function(){return this.value===0},o.prototype.isDivisibleBy=function(e){var t=z(e),n=t.value;return n===0?!1:n===1?!0:n===2?this.isEven():this.mod(t).equals(W[0])},u.prototype.isDivisibleBy=o.prototype.isDivisibleBy,o.prototype.isPrime=function(){var e=this.abs(),t=e.prev();if(e.isUnit())return!1;if(e.equals(2)||e.equals(3)||e.equals(5))return!0;if(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))return!1;if(e.lesser(25))return!0;var n=[2,3,5,7,11,13,17,19],r=t,i,s,o,u;while(r.isEven())r=r.divide(2);for(o=0;o<n.length;o++){u=bigInt(n[o]).modPow(r,e);if(u.equals(W[1])||u.equals(t))continue;for(s=!0,i=r;s&&i.lesser(t);i=i.multiply(2))u=u.square().mod(e),u.equals(t)&&(s=!1);if(s)return!1}return!0},u.prototype.isPrime=o.prototype.isPrime,o.prototype.next=function(){var e=this.value;return this.sign?b(e,1,this.sign):new o(m(e,1),this.sign)},u.prototype.next=function(){var e=this.value;return e+1<r?new u(e+1):new o(i,!1)},o.prototype.prev=function(){var e=this.value;return this.sign?new o(m(e,1),!0):b(e,1,this.sign)},u.prototype.prev=function(){var e=this.value;return e-1>-r?new u(e-1):new o(i,!0)};var O=[1];while(O[O.length-1]<=t)O.push(2*O[O.length-1]);var M=O.length,_=O[M-1];o.prototype.shiftLeft=function(e){if(!D(e))return e.isNegative()?this.shiftRight(e.abs()):this.times(W[2].pow(e));e=+e;if(e<0)return this.shiftRight(-e);var t=this;while(e>=M)t=t.multiply(_),e-=M-1;return t.multiply(O[e])},u.prototype.shiftLeft=o.prototype.shiftLeft,o.prototype.shiftRight=function(e){var t;if(!D(e))return e.isNegative()?this.shiftLeft(e.abs()):(t=this.divmod(W[2].pow(e)),t.remainder.isNegative()?t.quotient.prev():t.quotient);e=+e;if(e<0)return this.shiftLeft(-e);var n=this;while(e>=M){if(n.isZero())return n;t=L(n,_),n=t[1].isNegative()?t[0].prev():t[0],e-=M-1}return t=L(n,O[e]),t[1].isNegative()?t[0].prev():t[0]},u.prototype.shiftRight=o.prototype.shiftRight,o.prototype.not=function(){return this.negate().prev()},u.prototype.not=o.prototype.not,o.prototype.and=function(e){return P(this,e,function(e,t){return e&t})},u.prototype.and=o.prototype.and,o.prototype.or=function(e){return P(this,e,function(e,t){return e|t})},u.prototype.or=o.prototype.or,o.prototype.xor=function(e){return P(this,e,function(e,t){return e^t})},u.prototype.xor=o.prototype.xor;var q=function(e,t){var n=W[0],r=W[1],i=e.length;if(2<=t&&t<=36&&i<=s/Math.log(t))return new u(parseInt(e,t));t=z(t);var o=[],a,f=e[0]==="-";for(a=f?1:0;a<e.length;a++){var l=e[a].toLowerCase(),c=l.charCodeAt(0);if(48<=c&&c<=57)o.push(z(l));else if(97<=c&&c<=122)o.push(z(l.charCodeAt(0)-87));else{if(l!=="<")throw new Error(l+" is not a valid character");var h=a;do a++;while(e[a]!==">");o.push(z(e.slice(h+1,a)))}}o.reverse();for(a=0;a<o.length;a++)n=n.add(o[a].times(r)),r=r.times(t);return f?n.negate():n};o.prototype.toString=function(t){t===e&&(t=10);if(t!==10)return U(this,t);var n=this.value,r=n.length,i=String(n[--r]),s="0000000",o;while(--r>=0)o=String(n[r]),i+=s.slice(o.length)+o;var u=this.sign?"-":"";return u+i},u.prototype.toString=function(t){return t===e&&(t=10),t!=10?U(this,t):String(this.value)},o.prototype.valueOf=function(){return+this.toString()},o.prototype.toJSNumber=o.prototype.valueOf,u.prototype.valueOf=function(){return this.value},u.prototype.toJSNumber=u.prototype.valueOf;var W=function(e,t){return typeof e=="undefined"?W[0]:typeof t!="undefined"?+t===10?z(e):q(e,t):z(e)};for(var X=0;X<1e3;X++)W[X]=new u(X),X>0&&(W[-X]=new u(-X));return W.one=W[1],W.zero=W[0],W.minusOne=W[-1],W.max=H,W.min=B,W.gcd=j,W.lcm=F,W.isInstance=function(e){return e instanceof o||e instanceof u},W.randBetween=I,W}();typeof module!="undefined"&&module.hasOwnProperty("exports")&&(module.exports=bigInt);
1
+ var bigInt = (function (e) {'use strict'; function o(e, t) {this.value = e, this.sign = t, this.isSmall = !1;} function u(e) {this.value = e, this.sign = e < 0, this.isSmall = !0;} function a(e) {return -r < e && e < r;} function f(e) {return e < 1e7 ? [e] : e < 1e14 ? [e % 1e7, Math.floor(e / 1e7)] : [e % 1e7, Math.floor(e / 1e7) % 1e7, Math.floor(e / 1e14)];} function l(e) {c(e); var n = e.length; if (n < 4 && A(e, i) < 0) switch (n) {case 0:return 0; case 1:return e[0]; case 2:return e[0] + e[1] * t; default:return e[0] + (e[1] + e[2] * t) * t;} return e;} function c(e) {var t = e.length; while (e[--t] === 0);e.length = t + 1;} function h(e) {var t = new Array(e), n = -1; while (++n < e)t[n] = 0; return t;} function p(e) {return e > 0 ? Math.floor(e) : Math.ceil(e);} function d(e, n) {var r = e.length, i = n.length, s = new Array(r), o = 0, u = t, a, f; for (f = 0; f < i; f++)a = e[f] + n[f] + o, o = a >= u ? 1 : 0, s[f] = a - o * u; while (f < r)a = e[f] + o, o = a === u ? 1 : 0, s[f++] = a - o * u; return o > 0 && s.push(o), s;} function v(e, t) {return e.length >= t.length ? d(e, t) : d(t, e);} function m(e, n) {var r = e.length, i = new Array(r), s = t, o, u; for (u = 0; u < r; u++)o = e[u] - s + n, n = Math.floor(o / s), i[u] = o - n * s, n += 1; while (n > 0)i[u++] = n % s, n = Math.floor(n / s); return i;} function g(e, n) {var r = e.length, i = n.length, s = new Array(r), o = 0, u = t, a, f; for (a = 0; a < i; a++)f = e[a] - o - n[a], f < 0 ? (f += u, o = 1) : o = 0, s[a] = f; for (a = i; a < r; a++) {f = e[a] - o; if (!(f < 0)) {s[a++] = f; break;}f += u, s[a] = f;} for (;a < r; a++)s[a] = e[a]; return c(s), s;} function y(e, t, n) {var r, i; return A(e, t) >= 0 ? r = g(e, t) : (r = g(t, e), n = !n), r = l(r), typeof r === 'number' ? (n && (r = -r), new u(r)) : new o(r, n);} function b(e, n, r) {var i = e.length, s = new Array(i), a = -n, f = t, c, h; for (c = 0; c < i; c++)h = e[c] + a, a = Math.floor(h / f), s[c] = h < 0 ? h % f + f : h; return s = l(s), typeof s === 'number' ? (r && (s = -s), new u(s)) : new o(s, r);} function w(e, n) {var r = e.length, i = n.length, s = r + i, o = h(s), u = t, a, f, l, p, d; for (l = 0; l < r; ++l) {p = e[l]; for (var v = 0; v < i; ++v)d = n[v], a = p * d + o[l + v], f = Math.floor(a / u), o[l + v] = a - f * u, o[l + v + 1] += f;} return c(o), o;} function E(e, n) {var r = e.length, i = new Array(r), s = t, o = 0, u, a; for (a = 0; a < r; a++)u = e[a] * n + o, o = Math.floor(u / s), i[a] = u - o * s; while (o > 0)i[a++] = o % s, o = Math.floor(o / s); return i;} function S(e, t) {var n = []; while (t-- > 0)n.push(0); return n.concat(e);} function x(e, t) {var n = Math.max(e.length, t.length); if (n <= 400) return w(e, t); n = Math.ceil(n / 2); var r = e.slice(n), i = e.slice(0, n), s = t.slice(n), o = t.slice(0, n), u = x(i, o), a = x(r, s), f = x(v(i, r), v(o, s)); return v(v(u, S(g(g(f, u), a), n)), S(a, 2 * n));} function T(e) {var n = e.length, r = h(n + n), i = t, s, o, u, a, f; for (u = 0; u < n; u++) {a = e[u]; for (var l = 0; l < n; l++)f = e[l], s = a * f + r[u + l], o = Math.floor(s / i), r[u + l] = s - o * i, r[u + l + 1] += o;} return c(r), r;} function N(e, n) {var r = e.length, i = n.length, s = t, o = h(n.length), u = n[i - 1], a = Math.ceil(s / (2 * u)), f = E(e, a), c = E(n, a), p, d, v, m, g, y, b; f.length <= r && f.push(0), c.push(0), u = c[i - 1]; for (d = r - i; d >= 0; d--) {p = s - 1, p = Math.floor((f[d + i] * s + f[d + i - 1]) / u), v = 0, m = 0, y = c.length; for (g = 0; g < y; g++)v += p * c[g], b = Math.floor(v / s), m += f[d + g] - (v - b * s), v = b, m < 0 ? (f[d + g] = m + s, m = -1) : (f[d + g] = m, m = 0); while (m !== 0) {p -= 1, v = 0; for (g = 0; g < y; g++)v += f[d + g] - s + c[g], v < 0 ? (f[d + g] = v + s, v = 0) : (f[d + g] = v, v = 1); m += v;}o[d] = p;} return f = k(f, a)[0], [l(o), l(f)];} function C(e, n) {var r = e.length, i = n.length, s = [], o = [], u = t, a, f, c, h, p; while (r) {o.unshift(e[--r]); if (A(o, n) < 0) {s.push(0); continue;}f = o.length, c = o[f - 1] * u + o[f - 2], h = n[i - 1] * u + n[i - 2], f > i && (c = (c + 1) * u), a = Math.ceil(c / h); do {p = E(n, a); if (A(p, o) <= 0) break; a--;} while (a);s.push(a), o = g(o, p);} return s.reverse(), [l(s), l(o)];} function k(e, n) {var r = e.length, i = h(r), s = t, o, u, a, f; a = 0; for (o = r - 1; o >= 0; --o)f = a * s + e[o], u = p(f / n), a = f - u * n, i[o] = u | 0; return [i, a | 0];} function L(e, n) {var r, i = z(n), s = e.value, a = i.value, c; if (a === 0) throw new Error('Cannot divide by zero'); if (e.isSmall) return i.isSmall ? [new u(p(s / a)), new u(s % a)] : [W[0], e]; if (i.isSmall) {if (a === 1) return [e, W[0]]; if (a == -1) return [e.negate(), W[0]]; var h = Math.abs(a); if (h < t) {r = k(s, h), c = l(r[0]); var d = r[1]; return e.sign && (d = -d), typeof c === 'number' ? (e.sign !== i.sign && (c = -c), [new u(c), new u(d)]) : [new o(c, e.sign !== i.sign), new u(d)];}a = f(h);} var v = A(s, a); if (v === -1) return [W[0], e]; if (v === 0) return [W[e.sign === i.sign ? 1 : -1], W[0]]; s.length + a.length <= 200 ? r = N(s, a) : r = C(s, a), c = r[0]; var m = e.sign !== i.sign, g = r[1], y = e.sign; return typeof c === 'number' ? (m && (c = -c), c = new u(c)) : c = new o(c, m), typeof g === 'number' ? (y && (g = -g), g = new u(g)) : g = new o(g, y), [c, g];} function A(e, t) {if (e.length !== t.length) return e.length > t.length ? 1 : -1; for (var n = e.length - 1; n >= 0; n--) if (e[n] !== t[n]) return e[n] > t[n] ? 1 : -1; return 0;} function D(e) {return (typeof e === 'number' || typeof e === 'string') && +Math.abs(e) <= t || e instanceof o && e.value.length <= 1;} function P(e, t, n) {t = z(t); var r = e.isNegative(), i = t.isNegative(), s = r ? e.not() : e, o = i ? t.not() : t, u = [], a = [], f = !1, l = !1; while (!f || !l)s.isZero() ? (f = !0, u.push(r ? 1 : 0)) : r ? u.push(s.isEven() ? 1 : 0) : u.push(s.isEven() ? 0 : 1), o.isZero() ? (l = !0, a.push(i ? 1 : 0)) : i ? a.push(o.isEven() ? 1 : 0) : a.push(o.isEven() ? 0 : 1), s = s.over(2), o = o.over(2); var c = []; for (var h = 0; h < u.length; h++)c.push(n(u[h], a[h])); var p = bigInt(c.pop()).negate().times(bigInt(2).pow(c.length)); while (c.length)p = p.add(bigInt(c.pop()).times(bigInt(2).pow(c.length))); return p;} function H(e, t) {return e = z(e), t = z(t), e.greater(t) ? e : t;} function B(e, t) {return e = z(e), t = z(t), e.lesser(t) ? e : t;} function j(e, t) {return e = z(e).abs(), t = z(t).abs(), e.equals(t) ? e : e.isZero() ? t : t.isZero() ? e : e.isEven() ? t.isOdd() ? j(e.divide(2), t) : j(e.divide(2), t.divide(2)).multiply(2) : t.isEven() ? j(e, t.divide(2)) : e.greater(t) ? j(e.subtract(t).divide(2), t) : j(t.subtract(e).divide(2), e);} function F(e, t) {return e = z(e).abs(), t = z(t).abs(), e.multiply(t).divide(j(e, t));} function I(e, n) {e = z(e), n = z(n); var r = B(e, n), i = H(e, n), s = i.subtract(r); if (s.isSmall) return r.add(Math.random() * s); var u = s.value.length - 1, a = [], f = !0; for (var c = u; c >= 0; c--) {var h = f ? s.value[c] : t, d = p(Math.random() * h); a.unshift(d), d < h && (f = !1);} return a = l(a), r.add(new o(a, !1, typeof a === 'number'));} function R(e) {var t = e.value; return typeof t === 'number' && (t = [t]), t.length === 1 && t[0] <= 36 ? '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(t[0]) : '<' + t + '>';} function U(e, t) {t = bigInt(t); if (t.isZero()) {if (e.isZero()) return '0'; throw new Error('Cannot convert nonzero numbers to base 0.');} if (t.equals(-1)) return e.isZero() ? '0' : e.isNegative() ? (new Array(1 - e)).join('10') : '1' + (new Array(+e)).join('01'); var n = ''; e.isNegative() && t.isPositive() && (n = '-', e = e.abs()); if (t.equals(1)) return e.isZero() ? '0' : n + (new Array(+e + 1)).join(1); var r = [], i = e, s; while (i.isNegative() || i.compareAbs(t) >= 0) {s = i.divmod(t), i = s.quotient; var o = s.remainder; o.isNegative() && (o = t.minus(o).abs(), i = i.next()), r.push(R(o));} return r.push(R(i)), n + r.reverse().join('');} function z(e) {if (e instanceof o || e instanceof u) return e; if (typeof e === 'number') {if (a(e)) return new u(e); e = String(e);} if (typeof e === 'string') {if (a(+e)) {var t = +e; if (t === p(t)) return new u(t); throw 'Invalid integer: ' + e;} var r = e[0] === '-'; r && (e = e.slice(1)); var i = e.split(/e/i); if (i.length > 2) throw new Error('Invalid integer: ' + f.join('e')); if (i.length === 2) {var s = i[1]; s[0] === '+' && (s = s.slice(1)), s = +s; if (s !== p(s) || !a(s)) throw new Error('Invalid integer: ' + s + ' is not a valid exponent.'); var f = i[0], l = f.indexOf('.'); l >= 0 && (s -= f.length - l, f = f.slice(0, l) + f.slice(l + 1)); if (s < 0) throw new Error('Cannot include negative exponent part for integers'); f += (new Array(s + 1)).join('0'), e = f;} var h = /^([0-9][0-9]*)$/.test(e); if (!h) throw new Error('Invalid integer: ' + e); var d = [], v = e.length, m = n, g = v - m; while (v > 0)d.push(+e.slice(g, v)), g -= m, g < 0 && (g = 0), v -= m; return c(d), new o(d, r);}} var t = 1e7, n = 7, r = 9007199254740992, i = f(r), s = Math.log(r); o.prototype.add = function (e) {var t, n = z(e); if (this.sign !== n.sign) return this.subtract(n.negate()); var r = this.value, i = n.value; return n.isSmall ? new o(m(r, Math.abs(i)), this.sign) : new o(v(r, i), this.sign);}, o.prototype.plus = o.prototype.add, u.prototype.add = function (e) {var t = z(e), n = this.value; if (n < 0 !== t.sign) return this.subtract(t.negate()); var r = t.value; if (t.isSmall) {if (a(n + r)) return new u(n + r); r = f(Math.abs(r));} return new o(m(r, Math.abs(n)), n < 0);}, u.prototype.plus = u.prototype.add, o.prototype.subtract = function (e) {var t = z(e); if (this.sign !== t.sign) return this.add(t.negate()); var n = this.value, r = t.value; return t.isSmall ? b(n, Math.abs(r), this.sign) : y(n, r, this.sign);}, o.prototype.minus = o.prototype.subtract, u.prototype.subtract = function (e) {var t = z(e), n = this.value; if (n < 0 !== t.sign) return this.add(t.negate()); var r = t.value; return t.isSmall ? new u(n - r) : b(r, Math.abs(n), n >= 0);}, u.prototype.minus = u.prototype.subtract, o.prototype.negate = function () {return new o(this.value, !this.sign);}, u.prototype.negate = function () {var e = this.sign, t = new u(-this.value); return t.sign = !e, t;}, o.prototype.abs = function () {return new o(this.value, !1);}, u.prototype.abs = function () {return new u(Math.abs(this.value));}, o.prototype.multiply = function (e) {var n, r = z(e), i = this.value, s = r.value, u = this.sign !== r.sign, a; if (r.isSmall) {if (s === 0) return W[0]; if (s === 1) return this; if (s === -1) return this.negate(); a = Math.abs(s); if (a < t) return new o(E(i, a), u); s = f(a);} return i.length + s.length > 4e3 ? new o(x(i, s), u) : new o(w(i, s), u);}, o.prototype.times = o.prototype.multiply, u.prototype.multiply = function (e) {var n = z(e), r = this.value, i = n.value; if (r === 0) return W[0]; if (r === 1) return n; if (r === -1) return n.negate(); if (n.isSmall) {if (a(r * i)) return new u(r * i); i = f(Math.abs(i));} var s = Math.abs(r); return s < t ? new o(E(i, s), this.sign !== n.sign) : new o(w(i, f(s)), this.sign !== n.sign);}, u.prototype.times = u.prototype.multiply, o.prototype.square = function () {return new o(T(this.value), !1);}, u.prototype.square = function () {var e = this.value * this.value; return a(e) ? new u(e) : new o(T(f(Math.abs(this.value))), !1);}, o.prototype.divmod = function (e) {var t = L(this, e); return {quotient: t[0], remainder: t[1]};}, u.prototype.divmod = o.prototype.divmod, o.prototype.divide = function (e) {return L(this, e)[0];}, u.prototype.over = u.prototype.divide = o.prototype.over = o.prototype.divide, o.prototype.mod = function (e) {return L(this, e)[1];}, u.prototype.remainder = u.prototype.mod = o.prototype.remainder = o.prototype.mod, o.prototype.pow = function (e) {var t = z(e), n = this.value, r = t.value, i, s, o; if (r === 0) return W[1]; if (n === 0) return W[0]; if (n === 1) return W[1]; if (n === -1) return t.isEven() ? W[1] : W[-1]; if (t.sign) return W[0]; if (!t.isSmall) throw new Error('The exponent ' + t.toString() + ' is too large.'); if (this.isSmall && a(i = Math.pow(n, r))) return new u(p(i)); s = this, o = W[1]; for (;;) {r & !0 && (o = o.times(s), --r); if (r === 0) break; r /= 2, s = s.square();} return o;}, u.prototype.pow = o.prototype.pow, o.prototype.modPow = function (e, t) {e = z(e), t = z(t); if (t.isZero()) throw new Error('Cannot take modPow with modulus 0'); var n = W[1], r = this.mod(t); if (r.isZero()) return W[0]; while (e.isPositive())e.isOdd() && (n = n.multiply(r).mod(t)), e = e.divide(2), r = r.square().mod(t); return n;}, u.prototype.modPow = o.prototype.modPow, o.prototype.compareAbs = function (e) {var t = z(e), n = this.value, r = t.value; return t.isSmall ? 1 : A(n, r);}, u.prototype.compareAbs = function (e) {var t = z(e), n = Math.abs(this.value), r = t.value; return t.isSmall ? (r = Math.abs(r), n === r ? 0 : n > r ? 1 : -1) : -1;}, o.prototype.compare = function (e) {var t = z(e), n = this.value, r = t.value; return this.sign !== t.sign ? t.sign ? 1 : -1 : t.isSmall ? this.sign ? -1 : 1 : A(n, r) * (this.sign ? -1 : 1);}, o.prototype.compareTo = o.prototype.compare, u.prototype.compare = function (e) {var t = z(e), n = this.value, r = t.value; return t.isSmall ? n == r ? 0 : n > r ? 1 : -1 : n < 0 !== t.sign ? n < 0 ? -1 : 1 : n < 0 ? 1 : -1;}, u.prototype.compareTo = u.prototype.compare, o.prototype.equals = function (e) {return this.compare(e) === 0;}, u.prototype.eq = u.prototype.equals = o.prototype.eq = o.prototype.equals, o.prototype.notEquals = function (e) {return this.compare(e) !== 0;}, u.prototype.neq = u.prototype.notEquals = o.prototype.neq = o.prototype.notEquals, o.prototype.greater = function (e) {return this.compare(e) > 0;}, u.prototype.gt = u.prototype.greater = o.prototype.gt = o.prototype.greater, o.prototype.lesser = function (e) {return this.compare(e) < 0;}, u.prototype.lt = u.prototype.lesser = o.prototype.lt = o.prototype.lesser, o.prototype.greaterOrEquals = function (e) {return this.compare(e) >= 0;}, u.prototype.geq = u.prototype.greaterOrEquals = o.prototype.geq = o.prototype.greaterOrEquals, o.prototype.lesserOrEquals = function (e) {return this.compare(e) <= 0;}, u.prototype.leq = u.prototype.lesserOrEquals = o.prototype.leq = o.prototype.lesserOrEquals, o.prototype.isEven = function () {return (this.value[0] & 1) === 0;}, u.prototype.isEven = function () {return (this.value & 1) === 0;}, o.prototype.isOdd = function () {return (this.value[0] & 1) === 1;}, u.prototype.isOdd = function () {return (this.value & 1) === 1;}, o.prototype.isPositive = function () {return !this.sign;}, u.prototype.isPositive = function () {return this.value > 0;}, o.prototype.isNegative = function () {return this.sign;}, u.prototype.isNegative = function () {return this.value < 0;}, o.prototype.isUnit = function () {return !1;}, u.prototype.isUnit = function () {return Math.abs(this.value) === 1;}, o.prototype.isZero = function () {return !1;}, u.prototype.isZero = function () {return this.value === 0;}, o.prototype.isDivisibleBy = function (e) {var t = z(e), n = t.value; return n === 0 ? !1 : n === 1 ? !0 : n === 2 ? this.isEven() : this.mod(t).equals(W[0]);}, u.prototype.isDivisibleBy = o.prototype.isDivisibleBy, o.prototype.isPrime = function () {var e = this.abs(), t = e.prev(); if (e.isUnit()) return !1; if (e.equals(2) || e.equals(3) || e.equals(5)) return !0; if (e.isEven() || e.isDivisibleBy(3) || e.isDivisibleBy(5)) return !1; if (e.lesser(25)) return !0; var n = [2, 3, 5, 7, 11, 13, 17, 19], r = t, i, s, o, u; while (r.isEven())r = r.divide(2); for (o = 0; o < n.length; o++) {u = bigInt(n[o]).modPow(r, e); if (u.equals(W[1]) || u.equals(t)) continue; for (s = !0, i = r; s && i.lesser(t); i = i.multiply(2))u = u.square().mod(e), u.equals(t) && (s = !1); if (s) return !1;} return !0;}, u.prototype.isPrime = o.prototype.isPrime, o.prototype.next = function () {var e = this.value; return this.sign ? b(e, 1, this.sign) : new o(m(e, 1), this.sign);}, u.prototype.next = function () {var e = this.value; return e + 1 < r ? new u(e + 1) : new o(i, !1);}, o.prototype.prev = function () {var e = this.value; return this.sign ? new o(m(e, 1), !0) : b(e, 1, this.sign);}, u.prototype.prev = function () {var e = this.value; return e - 1 > -r ? new u(e - 1) : new o(i, !0);}; var O = [1]; while (O[O.length - 1] <= t)O.push(2 * O[O.length - 1]); var M = O.length, _ = O[M - 1]; o.prototype.shiftLeft = function (e) {if (!D(e)) return e.isNegative() ? this.shiftRight(e.abs()) : this.times(W[2].pow(e)); e = +e; if (e < 0) return this.shiftRight(-e); var t = this; while (e >= M)t = t.multiply(_), e -= M - 1; return t.multiply(O[e]);}, u.prototype.shiftLeft = o.prototype.shiftLeft, o.prototype.shiftRight = function (e) {var t; if (!D(e)) return e.isNegative() ? this.shiftLeft(e.abs()) : (t = this.divmod(W[2].pow(e)), t.remainder.isNegative() ? t.quotient.prev() : t.quotient); e = +e; if (e < 0) return this.shiftLeft(-e); var n = this; while (e >= M) {if (n.isZero()) return n; t = L(n, _), n = t[1].isNegative() ? t[0].prev() : t[0], e -= M - 1;} return t = L(n, O[e]), t[1].isNegative() ? t[0].prev() : t[0];}, u.prototype.shiftRight = o.prototype.shiftRight, o.prototype.not = function () {return this.negate().prev();}, u.prototype.not = o.prototype.not, o.prototype.and = function (e) {return P(this, e, function (e, t) {return e & t;});}, u.prototype.and = o.prototype.and, o.prototype.or = function (e) {return P(this, e, function (e, t) {return e | t;});}, u.prototype.or = o.prototype.or, o.prototype.xor = function (e) {return P(this, e, function (e, t) {return e ^ t;});}, u.prototype.xor = o.prototype.xor; var q = function (e, t) {var n = W[0], r = W[1], i = e.length; if (t >= 2 && t <= 36 && i <= s / Math.log(t)) return new u(parseInt(e, t)); t = z(t); var o = [], a, f = e[0] === '-'; for (a = f ? 1 : 0; a < e.length; a++) {var l = e[a].toLowerCase(), c = l.charCodeAt(0); if (c >= 48 && c <= 57)o.push(z(l)); else if (c >= 97 && c <= 122)o.push(z(l.charCodeAt(0) - 87)); else {if (l !== '<') throw new Error(l + ' is not a valid character'); var h = a; do a++; while (e[a] !== '>');o.push(z(e.slice(h + 1, a)));}}o.reverse(); for (a = 0; a < o.length; a++)n = n.add(o[a].times(r)), r = r.times(t); return f ? n.negate() : n;}; o.prototype.toString = function (t) {t === e && (t = 10); if (t !== 10) return U(this, t); var n = this.value, r = n.length, i = String(n[--r]), s = '0000000', o; while (--r >= 0)o = String(n[r]), i += s.slice(o.length) + o; var u = this.sign ? '-' : ''; return u + i;}, u.prototype.toString = function (t) {return t === e && (t = 10), t != 10 ? U(this, t) : String(this.value);}, o.prototype.valueOf = function () {return +this.toString();}, o.prototype.toJSNumber = o.prototype.valueOf, u.prototype.valueOf = function () {return this.value;}, u.prototype.toJSNumber = u.prototype.valueOf; var W = function (e, t) {return typeof e === 'undefined' ? W[0] : typeof t !== 'undefined' ? +t === 10 ? z(e) : q(e, t) : z(e);}; for (var X = 0; X < 1e3; X++)W[X] = new u(X), X > 0 && (W[-X] = new u(-X)); return W.one = W[1], W.zero = W[0], W.minusOne = W[-1], W.max = H, W.min = B, W.gcd = j, W.lcm = F, W.isInstance = function (e) {return e instanceof o || e instanceof u;}, W.randBetween = I, W;}()); typeof module !== 'undefined' && module.hasOwnProperty('exports') && (module.exports = bigInt);
@@ -1,14 +1,13 @@
1
1
  var accumulate = require('./accumulate');
2
2
 
3
- describe('accumulate()', function() {
4
-
5
- it('accumulation empty', function() {
6
- var accumulator = function(e) { return e * e; };
3
+ describe('accumulate()', function () {
4
+ it('accumulation empty', function () {
5
+ var accumulator = function (e) { return e * e; };
7
6
  expect(accumulate([], accumulator)).toEqual([]);
8
7
  });
9
8
 
10
- xit('accumulate squares', function() {
11
- var accumulator = function(number) {
9
+ xit('accumulate squares', function () {
10
+ var accumulator = function (number) {
12
11
  return number * number;
13
12
  };
14
13
 
@@ -17,8 +16,8 @@ describe('accumulate()', function() {
17
16
  expect(result).toEqual([1, 4, 9]);
18
17
  });
19
18
 
20
- xit('accumulate upcases', function() {
21
- var accumulator = function(word) {
19
+ xit('accumulate upcases', function () {
20
+ var accumulator = function (word) {
22
21
  return word.toUpperCase();
23
22
  };
24
23
 
@@ -27,8 +26,8 @@ describe('accumulate()', function() {
27
26
  expect(result).toEqual(['HELLO', 'WORLD']);
28
27
  });
29
28
 
30
- xit('accumulate reversed strings', function() {
31
- var accumulator = function(word) {
29
+ xit('accumulate reversed strings', function () {
30
+ var accumulator = function (word) {
32
31
  return word.split('').reverse().join('');
33
32
  };
34
33
 
@@ -37,14 +36,13 @@ describe('accumulate()', function() {
37
36
  expect(result).toEqual(['eht', 'kciuq', 'nworb', 'xof', 'cte']);
38
37
  });
39
38
 
40
- xit('accumulate recursively', function() {
41
- var result = accumulate('a b c'.split(/\s/), function(char) {
42
- return accumulate('1 2 3'.split(/\s/), function(digit) {
39
+ xit('accumulate recursively', function () {
40
+ var result = accumulate('a b c'.split(/\s/), function (char) {
41
+ return accumulate('1 2 3'.split(/\s/), function (digit) {
43
42
  return char + digit;
44
43
  });
45
44
  });
46
45
 
47
46
  expect(result).toEqual([['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']]);
48
47
  });
49
-
50
48
  });
@@ -1,27 +1,27 @@
1
1
  var Acronyms = require('./acronym');
2
2
 
3
- describe('Acronyms are produced from', function(){
4
- it('title cased phrases', function() {
3
+ describe('Acronyms are produced from', function () {
4
+ it('title cased phrases', function () {
5
5
  expect(Acronyms.parse('Portable Network Graphics')).toEqual('PNG');
6
6
  });
7
7
 
8
- it('other title cased phrases', function(){
8
+ it('other title cased phrases', function () {
9
9
  expect(Acronyms.parse('Ruby on Rails')).toEqual('ROR');
10
10
  });
11
11
 
12
- it('inconsistently cased phrases', function(){
12
+ it('inconsistently cased phrases', function () {
13
13
  expect(Acronyms.parse('HyperText Markup Language')).toEqual('HTML');
14
14
  });
15
15
 
16
- it('phrases with punctuation', function() {
16
+ it('phrases with punctuation', function () {
17
17
  expect(Acronyms.parse('First In, First Out')).toEqual('FIFO');
18
18
  });
19
19
 
20
- it('other phrases with punctuation', function() {
20
+ it('other phrases with punctuation', function () {
21
21
  expect(Acronyms.parse('PHP: Hypertext Preprocessor')).toEqual('PHP');
22
22
  });
23
23
 
24
- it('phrases with punctuation and sentence casing', function() {
24
+ it('phrases with punctuation and sentence casing', function () {
25
25
  expect(Acronyms.parse('Complementary metal-oxide semiconductor')).toEqual('CMOS');
26
26
  });
27
27
  });
@@ -2,7 +2,7 @@ module.exports = {
2
2
  parse: function (phrase) {
3
3
  return phrase.match(/[A-Z]+[a-z]*|[a-z]+/g)
4
4
  .reduce(function (acronym, word) {
5
- return acronym += word[0].toUpperCase()
5
+ return acronym += word[0].toUpperCase();
6
6
  }, '');
7
7
  }
8
8
  };
@@ -5,7 +5,6 @@ const Converter = require('./all-your-base');
5
5
  const converter = new Converter();
6
6
 
7
7
  describe('Converter', function () {
8
-
9
8
  xit('single bit one to decimal', function () {
10
9
  expect(converter.convert([1], 2, 10)).toEqual([1]);
11
10
  });
@@ -137,5 +136,4 @@ describe('Converter', function () {
137
136
  converter.convert([0], 3, 2.5);
138
137
  }).toThrow(new Error('Wrong output base'));
139
138
  });
140
-
141
139
  });
@@ -1,66 +1,65 @@
1
1
  var Allergies = require('./allergies');
2
2
 
3
- describe('Allergies',function() {
4
-
5
- it('no allergies at all', function() {
3
+ describe('Allergies', function () {
4
+ it('no allergies at all', function () {
6
5
  var allergies = new Allergies(0);
7
6
  expect(allergies.list()).toEqual([]);
8
7
  });
9
8
 
10
- xit('allergies to eggs', function() {
9
+ xit('allergies to eggs', function () {
11
10
  var allergies = new Allergies(1);
12
11
  expect(allergies.list()).toEqual([ 'eggs' ]);
13
12
  });
14
13
 
15
- xit('allergies to peanuts', function() {
14
+ xit('allergies to peanuts', function () {
16
15
  var allergies = new Allergies(2);
17
16
  expect(allergies.list()).toEqual([ 'peanuts' ]);
18
17
  });
19
18
 
20
- xit('allergies to strawberries', function() {
19
+ xit('allergies to strawberries', function () {
21
20
  var allergies = new Allergies(8);
22
21
  expect(allergies.list()).toEqual([ 'strawberries' ]);
23
22
  });
24
23
 
25
- xit('allergies to eggs and peanuts', function() {
24
+ xit('allergies to eggs and peanuts', function () {
26
25
  var allergies = new Allergies(3);
27
26
  expect(allergies.list()).toEqual([ 'eggs', 'peanuts' ]);
28
27
  });
29
28
 
30
- xit('allergies to more than eggs but not peanuts', function() {
29
+ xit('allergies to more than eggs but not peanuts', function () {
31
30
  var allergies = new Allergies(5);
32
31
  expect(allergies.list()).toEqual([ 'eggs', 'shellfish' ]);
33
32
  });
34
33
 
35
- xit('allergic to lots of stuff', function() {
34
+ xit('allergic to lots of stuff', function () {
36
35
  var allergies = new Allergies(248);
37
36
  expect(allergies.list()).toEqual(['strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats']);
38
37
  });
39
38
 
40
- xit('allergic to everything', function() {
39
+ xit('allergic to everything', function () {
41
40
  var allergies = new Allergies(255);
42
41
  expect(allergies.list()).toEqual(['eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats']);
43
42
  });
44
43
 
45
- xit('no allergic means not allergic', function() {
44
+ xit('no allergic means not allergic', function () {
46
45
  var allergies = new Allergies(0);
47
46
  expect(allergies.allergicTo('peanuts')).toEqual(false);
48
47
  expect(allergies.allergicTo('cats')).toEqual(false);
49
48
  expect(allergies.allergicTo('strawberries')).toEqual(false);
50
49
  });
51
50
 
52
- xit('allergic to eggs', function() {
51
+ xit('allergic to eggs', function () {
53
52
  var allergies = new Allergies(1);
54
53
  expect(allergies.allergicTo('eggs')).toEqual(true);
55
54
  });
56
55
 
57
- xit('allergic to eggs and other things', function() {
56
+ xit('allergic to eggs and other things', function () {
58
57
  var allergies = new Allergies(5);
59
58
  expect(allergies.allergicTo('eggs')).toEqual(true);
60
59
  });
61
60
 
62
- xit('ignore non allergen score parts', function() {
61
+ xit('ignore non allergen score parts', function () {
63
62
  var allergies = new Allergies(509);
64
63
  expect(allergies.list()).toEqual(['eggs', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats']);
65
64
  });
66
- });
65
+ });
@@ -5,23 +5,23 @@ function Allergies(allergenIndex) {
5
5
  }
6
6
 
7
7
  Allergies.possibleAllergies = [ 'eggs', 'peanuts', 'shellfish', 'strawberries',
8
- 'tomatoes', 'chocolate', 'pollen', 'cats'];
8
+ 'tomatoes', 'chocolate', 'pollen', 'cats'];
9
9
 
10
10
  Allergies.prototype = {
11
- list: function() {
11
+ list: function () {
12
12
  var possibleAllergies = Allergies.possibleAllergies;
13
13
 
14
14
  var allergicTo = [];
15
15
 
16
16
  for (var i = 0; i < possibleAllergies.length; i++) {
17
17
  var allergy = possibleAllergies[i];
18
- if (this.allergenIndex & Math.pow(2,i)) {
18
+ if (this.allergenIndex & Math.pow(2, i)) {
19
19
  allergicTo.push(allergy);
20
20
  }
21
21
  }
22
22
  return allergicTo;
23
23
  },
24
- allergicTo: function(food) {
24
+ allergicTo: function (food) {
25
25
  var isAllergic = false;
26
26
 
27
27
  var allergyList = this.list();
@@ -36,4 +36,4 @@ Allergies.prototype = {
36
36
  }
37
37
  };
38
38
 
39
- module.exports = Allergies;
39
+ module.exports = Allergies;
@@ -1,95 +1,93 @@
1
1
  var solve = require('./alphametics');
2
2
 
3
- describe("Solve the alphametics puzzle", function() {
4
-
5
- it("puzzle with three letters", function() {
6
- var puzzle = "I + BB == ILL";
3
+ describe('Solve the alphametics puzzle', function () {
4
+ it('puzzle with three letters', function () {
5
+ var puzzle = 'I + BB == ILL';
7
6
  var expected = {
8
- "I": 1,
9
- "B": 9,
10
- "L": 0
7
+ 'I': 1,
8
+ 'B': 9,
9
+ 'L': 0
11
10
  };
12
11
  expect(solve(puzzle)).toEqual(expected);
13
12
  });
14
13
 
15
- xit("solution must have unique value for each letter", function() {
16
- var puzzle = "A == B";
14
+ xit('solution must have unique value for each letter', function () {
15
+ var puzzle = 'A == B';
17
16
  expect(solve(puzzle)).toBeNull();
18
17
  });
19
18
 
20
- xit("leading zero solution is invalid", function() {
21
- var puzzle = "ACA + DD == BD";
19
+ xit('leading zero solution is invalid', function () {
20
+ var puzzle = 'ACA + DD == BD';
22
21
  expect(solve(puzzle)).toBeNull();
23
22
  });
24
23
 
25
- xit("puzzle with four letters", function() {
26
- var puzzle = "AS + A == MOM";
24
+ xit('puzzle with four letters', function () {
25
+ var puzzle = 'AS + A == MOM';
27
26
  var expected = {
28
- "A": 9,
29
- "S": 2,
30
- "M": 1,
31
- "O": 0
27
+ 'A': 9,
28
+ 'S': 2,
29
+ 'M': 1,
30
+ 'O': 0
32
31
  };
33
32
  expect(solve(puzzle)).toEqual(expected);
34
33
  });
35
34
 
36
- xit("puzzle with six letters", function() {
37
- var puzzle = "NO + NO + TOO == LATE";
35
+ xit('puzzle with six letters', function () {
36
+ var puzzle = 'NO + NO + TOO == LATE';
38
37
  var expected = {
39
- "N": 7,
40
- "O": 4,
41
- "T": 9,
42
- "L": 1,
43
- "A": 0,
44
- "E": 2
38
+ 'N': 7,
39
+ 'O': 4,
40
+ 'T': 9,
41
+ 'L': 1,
42
+ 'A': 0,
43
+ 'E': 2
45
44
  };
46
45
  expect(solve(puzzle)).toEqual(expected);
47
46
  });
48
47
 
49
- xit("puzzle with seven letters", function() {
50
- var puzzle = "HE + SEES + THE == LIGHT";
48
+ xit('puzzle with seven letters', function () {
49
+ var puzzle = 'HE + SEES + THE == LIGHT';
51
50
  var expected = {
52
- "E": 4,
53
- "G": 2,
54
- "H": 5,
55
- "I": 0,
56
- "L": 1,
57
- "S": 9,
58
- "T": 7
51
+ 'E': 4,
52
+ 'G': 2,
53
+ 'H': 5,
54
+ 'I': 0,
55
+ 'L': 1,
56
+ 'S': 9,
57
+ 'T': 7
59
58
  };
60
59
  expect(solve(puzzle)).toEqual(expected);
61
60
  });
62
61
 
63
- xit("puzzle with eight letters", function() {
64
- var puzzle = "SEND + MORE == MONEY";
62
+ xit('puzzle with eight letters', function () {
63
+ var puzzle = 'SEND + MORE == MONEY';
65
64
  var expected = {
66
- "S": 9,
67
- "E": 5,
68
- "N": 6,
69
- "D": 7,
70
- "M": 1,
71
- "O": 0,
72
- "R": 8,
73
- "Y": 2
65
+ 'S': 9,
66
+ 'E': 5,
67
+ 'N': 6,
68
+ 'D': 7,
69
+ 'M': 1,
70
+ 'O': 0,
71
+ 'R': 8,
72
+ 'Y': 2
74
73
  };
75
74
  expect(solve(puzzle)).toEqual(expected);
76
75
  });
77
76
 
78
- xit("puzzle with ten letters", function() {
79
- var puzzle = "AND + A + STRONG + OFFENSE + AS + A + GOOD == DEFENSE";
77
+ xit('puzzle with ten letters', function () {
78
+ var puzzle = 'AND + A + STRONG + OFFENSE + AS + A + GOOD == DEFENSE';
80
79
  var expected = {
81
- "A": 5,
82
- "D": 3,
83
- "E": 4,
84
- "F": 7,
85
- "G": 8,
86
- "N": 0,
87
- "O": 2,
88
- "R": 1,
89
- "S": 6,
90
- "T": 9
80
+ 'A': 5,
81
+ 'D': 3,
82
+ 'E': 4,
83
+ 'F': 7,
84
+ 'G': 8,
85
+ 'N': 0,
86
+ 'O': 2,
87
+ 'R': 1,
88
+ 'S': 6,
89
+ 'T': 9
91
90
  };
92
91
  expect(solve(puzzle)).toEqual(expected);
93
- });
94
-
92
+ });
95
93
  });