puzzle-lib 1.6.0 → 1.7.0

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 (143) hide show
  1. package/build/src/Braille/BrailleCharacter.d.ts +15 -15
  2. package/build/src/Braille/BrailleCharacter.js +39 -38
  3. package/build/src/Braille/BrailleCharacter.js.map +1 -1
  4. package/build/src/Braille/BrailleData.d.ts +6 -6
  5. package/build/src/Braille/BrailleData.js +65 -65
  6. package/build/src/Braille/BrailleData.js.map +1 -1
  7. package/build/src/Braille/BrailleDot.d.ts +9 -9
  8. package/build/src/Braille/BrailleDot.js +13 -13
  9. package/build/src/Braille/BrailleDot.js.map +1 -1
  10. package/build/src/Braille/BrailleEncoding.d.ts +54 -54
  11. package/build/src/Braille/BrailleEncoding.js +66 -65
  12. package/build/src/Braille/BrailleEncoding.js.map +1 -1
  13. package/build/src/Braille/BrailleStream.d.ts +18 -18
  14. package/build/src/Braille/BrailleStream.js +75 -75
  15. package/build/src/Braille/BrailleStream.js.map +1 -1
  16. package/build/src/Cipher/AutoKeyString.d.ts +4 -4
  17. package/build/src/Cipher/AutoKeyString.js +34 -34
  18. package/build/src/Cipher/CaesarString.d.ts +8 -8
  19. package/build/src/Cipher/CaesarString.js +32 -31
  20. package/build/src/Cipher/CaesarString.js.map +1 -1
  21. package/build/src/Cipher/CaesarUtils.d.ts +13 -13
  22. package/build/src/Cipher/CaesarUtils.js +57 -57
  23. package/build/src/Cipher/CaesarUtils.js.map +1 -1
  24. package/build/src/Cipher/KeyedCipherStringBase.d.ts +12 -12
  25. package/build/src/Cipher/KeyedCipherStringBase.js +30 -28
  26. package/build/src/Cipher/KeyedCipherStringBase.js.map +1 -1
  27. package/build/src/Cipher/VigenereString.d.ts +4 -4
  28. package/build/src/Cipher/VigenereString.js +21 -21
  29. package/build/src/Common/CharacterImage.d.ts +6 -6
  30. package/build/src/Common/CharacterImage.js +12 -10
  31. package/build/src/Common/CharacterImage.js.map +1 -1
  32. package/build/src/Common/EncodingCategory.d.ts +8 -8
  33. package/build/src/Common/EncodingCategory.js +12 -12
  34. package/build/src/Common/EncodingCategory.js.map +1 -1
  35. package/build/src/Common/EncodingCharacterBase.d.ts +23 -23
  36. package/build/src/Common/EncodingCharacterBase.js +54 -52
  37. package/build/src/Common/EncodingCharacterBase.js.map +1 -1
  38. package/build/src/Common/EncodingDataBase.d.ts +7 -7
  39. package/build/src/Common/EncodingDataBase.js +27 -29
  40. package/build/src/Common/EncodingDataBase.js.map +1 -1
  41. package/build/src/Common/EncodingEntry.d.ts +8 -8
  42. package/build/src/Common/EncodingEntry.js +17 -14
  43. package/build/src/Common/EncodingEntry.js.map +1 -1
  44. package/build/src/Common/EncodingLookupResult.d.ts +6 -6
  45. package/build/src/Common/EncodingLookupResult.js +11 -13
  46. package/build/src/Common/EncodingLookupResult.js.map +1 -1
  47. package/build/src/Common/Helpers.d.ts +4 -4
  48. package/build/src/Common/Helpers.js +16 -16
  49. package/build/src/Common/InlineSvg.d.ts +7 -7
  50. package/build/src/Common/InlineSvg.js +17 -14
  51. package/build/src/Common/InlineSvg.js.map +1 -1
  52. package/build/src/Conversion/CharacterAutoConvert.d.ts +10 -10
  53. package/build/src/Conversion/CharacterAutoConvert.js +88 -88
  54. package/build/src/Conversion/CharacterAutoConvert.js.map +1 -1
  55. package/build/src/Conversion/CharacterConversion.d.ts +8 -8
  56. package/build/src/Conversion/CharacterConversion.js +50 -50
  57. package/build/src/Conversion/CharacterEncoding.d.ts +9 -9
  58. package/build/src/Conversion/CharacterEncoding.js +13 -13
  59. package/build/src/Conversion/CharacterEncoding.js.map +1 -1
  60. package/build/src/Conversion/CharacterTableEntry.d.ts +10 -10
  61. package/build/src/Conversion/CharacterTableEntry.js +25 -19
  62. package/build/src/Conversion/CharacterTableEntry.js.map +1 -1
  63. package/build/src/Conversion/SignificantFigures.d.ts +7 -7
  64. package/build/src/Conversion/SignificantFigures.js +50 -50
  65. package/build/src/Conversion/StringAutoConvert.d.ts +6 -6
  66. package/build/src/Conversion/StringAutoConvert.js +46 -46
  67. package/build/src/Morse/MorseCharacter.d.ts +22 -22
  68. package/build/src/Morse/MorseCharacter.js +97 -96
  69. package/build/src/Morse/MorseCharacter.js.map +1 -1
  70. package/build/src/Morse/MorseData.d.ts +6 -6
  71. package/build/src/Morse/MorseData.js +70 -70
  72. package/build/src/Morse/MorseData.js.map +1 -1
  73. package/build/src/Morse/MorseEncoding.d.ts +59 -59
  74. package/build/src/Morse/MorseEncoding.js +94 -94
  75. package/build/src/Morse/MorseEncoding.js.map +1 -1
  76. package/build/src/Morse/MorseString.d.ts +10 -10
  77. package/build/src/Morse/MorseString.js +67 -66
  78. package/build/src/Morse/MorseString.js.map +1 -1
  79. package/build/src/Nato/NatoCharacter.d.ts +5 -5
  80. package/build/src/Nato/NatoCharacter.js +12 -10
  81. package/build/src/Nato/NatoCharacter.js.map +1 -1
  82. package/build/src/Nato/NatoData.d.ts +7 -7
  83. package/build/src/Nato/NatoData.js +49 -51
  84. package/build/src/Nato/NatoData.js.map +1 -1
  85. package/build/src/NavalFlags/NavalFlags.d.ts +7 -7
  86. package/build/src/NavalFlags/NavalFlags.js +75 -77
  87. package/build/src/NavalFlags/NavalFlags.js.map +1 -1
  88. package/build/src/Resistor/Resistor.d.ts +24 -24
  89. package/build/src/Resistor/Resistor.js +86 -86
  90. package/build/src/Resistor/Resistor.js.map +1 -1
  91. package/build/src/Resistor/ResistorColorEntry.d.ts +12 -12
  92. package/build/src/Resistor/ResistorColorEntry.js +36 -31
  93. package/build/src/Resistor/ResistorColorEntry.js.map +1 -1
  94. package/build/src/Semaphore/SemaphoreCharacter.d.ts +20 -20
  95. package/build/src/Semaphore/SemaphoreCharacter.js +75 -75
  96. package/build/src/Semaphore/SemaphoreCharacter.js.map +1 -1
  97. package/build/src/Semaphore/SemaphoreData.d.ts +6 -6
  98. package/build/src/Semaphore/SemaphoreData.js +53 -53
  99. package/build/src/Semaphore/SemaphoreData.js.map +1 -1
  100. package/build/src/Semaphore/SemaphoreDegrees.d.ts +5 -5
  101. package/build/src/Semaphore/SemaphoreDegrees.js +26 -26
  102. package/build/src/Semaphore/SemaphoreDirection.d.ts +11 -11
  103. package/build/src/Semaphore/SemaphoreDirection.js +15 -15
  104. package/build/src/Semaphore/SemaphoreDirection.js.map +1 -1
  105. package/build/src/Semaphore/SemaphoreEncoding.d.ts +40 -40
  106. package/build/src/Semaphore/SemaphoreEncoding.js +48 -47
  107. package/build/src/Semaphore/SemaphoreEncoding.js.map +1 -1
  108. package/build/src/Semaphore/SemaphoreStream.d.ts +17 -17
  109. package/build/src/Semaphore/SemaphoreStream.js +73 -72
  110. package/build/src/Semaphore/SemaphoreStream.js.map +1 -1
  111. package/build/src/WordSearch/Point.d.ts +4 -4
  112. package/build/src/WordSearch/Point.js +2 -2
  113. package/build/src/WordSearch/Result.d.ts +6 -6
  114. package/build/src/WordSearch/Result.js +12 -10
  115. package/build/src/WordSearch/Result.js.map +1 -1
  116. package/build/src/WordSearch/WordSearchDirection.d.ts +6 -6
  117. package/build/src/WordSearch/WordSearchDirection.js +10 -10
  118. package/build/src/WordSearch/WordSearchDirection.js.map +1 -1
  119. package/build/src/WordSearch/WordSearchSolver.d.ts +27 -27
  120. package/build/src/WordSearch/WordSearchSolver.js +232 -222
  121. package/build/src/WordSearch/WordSearchSolver.js.map +1 -1
  122. package/build/src/index.d.ts +35 -35
  123. package/build/src/index.js +72 -72
  124. package/package.json +5 -5
  125. package/src/Braille/BrailleCharacter.ts +1 -1
  126. package/src/Braille/BrailleData.ts +16 -16
  127. package/src/Cipher/AutoKeyString.ts +1 -1
  128. package/src/Cipher/CaesarUtils.ts +1 -1
  129. package/src/Cipher/VigenereString.ts +1 -1
  130. package/src/Common/EncodingDataBase.ts +1 -1
  131. package/src/Conversion/CharacterAutoConvert.ts +1 -1
  132. package/src/Conversion/CharacterConversion.ts +5 -5
  133. package/src/Conversion/SignificantFigures.ts +1 -1
  134. package/src/Conversion/StringAutoConvert.ts +2 -2
  135. package/src/Morse/MorseData.ts +18 -18
  136. package/src/Morse/MorseString.ts +12 -12
  137. package/src/Nato/NatoData.ts +1 -1
  138. package/src/NavalFlags/NavalFlags.ts +52 -52
  139. package/src/Resistor/Resistor.ts +9 -9
  140. package/src/Resistor/ResistorColorEntry.ts +1 -1
  141. package/src/Semaphore/SemaphoreCharacter.ts +5 -5
  142. package/src/Semaphore/SemaphoreData.ts +1 -1
  143. package/src/WordSearch/WordSearchSolver.ts +1 -1
@@ -1,59 +1,59 @@
1
- export declare enum MorseEncoding {
2
- None = 0,
3
- Dot = 1,
4
- Dash = 2,
5
- LetterA,
6
- LetterB,
7
- LetterC,
8
- LetterD,
9
- LetterE,
10
- LetterF,
11
- LetterG,
12
- LetterH,
13
- LetterI,
14
- LetterJ,
15
- LetterK,
16
- LetterL,
17
- LetterM,
18
- LetterN,
19
- LetterO,
20
- LetterP,
21
- LetterQ,
22
- LetterR,
23
- LetterS,
24
- LetterT,
25
- LetterU,
26
- LetterV,
27
- LetterW,
28
- LetterX,
29
- LetterY,
30
- LetterZ,
31
- Number0,
32
- Number1,
33
- Number2,
34
- Number3,
35
- Number4,
36
- Number5,
37
- Number6,
38
- Number7,
39
- Number8,
40
- Number9,
41
- PunctuationPeriod,
42
- PunctuationComma,
43
- PunctuationQuestionMark,
44
- PunctuationApostrophe,
45
- PunctuationExclamationPoint,
46
- PunctuationForwardSlash,
47
- PunctuationOpenParenthesis,
48
- PunctuationCloseParenthesis,
49
- PunctuationAmpersand,
50
- PunctuationColon,
51
- PunctuationSemicolon,
52
- PunctuationDoubleDash,
53
- PunctuationPlusSign,
54
- PunctuationHyphen,
55
- PunctuationUnderscore,
56
- PunctuationQuotationMark,
57
- PunctuationDollarSign,
58
- PunctuationAtSign
59
- }
1
+ export declare enum MorseEncoding {
2
+ None = 0,
3
+ Dot = 1,
4
+ Dash = 2,
5
+ LetterA,
6
+ LetterB,
7
+ LetterC,
8
+ LetterD,
9
+ LetterE,
10
+ LetterF,
11
+ LetterG,
12
+ LetterH,
13
+ LetterI,
14
+ LetterJ,
15
+ LetterK,
16
+ LetterL,
17
+ LetterM,
18
+ LetterN,
19
+ LetterO,
20
+ LetterP,
21
+ LetterQ,
22
+ LetterR,
23
+ LetterS,
24
+ LetterT,
25
+ LetterU,
26
+ LetterV,
27
+ LetterW,
28
+ LetterX,
29
+ LetterY,
30
+ LetterZ,
31
+ Number0,
32
+ Number1,
33
+ Number2,
34
+ Number3,
35
+ Number4,
36
+ Number5,
37
+ Number6,
38
+ Number7,
39
+ Number8,
40
+ Number9,
41
+ PunctuationPeriod,
42
+ PunctuationComma,
43
+ PunctuationQuestionMark,
44
+ PunctuationApostrophe,
45
+ PunctuationExclamationPoint,
46
+ PunctuationForwardSlash,
47
+ PunctuationOpenParenthesis,
48
+ PunctuationCloseParenthesis,
49
+ PunctuationAmpersand,
50
+ PunctuationColon,
51
+ PunctuationSemicolon,
52
+ PunctuationDoubleDash,
53
+ PunctuationPlusSign,
54
+ PunctuationHyphen,
55
+ PunctuationUnderscore,
56
+ PunctuationQuotationMark,
57
+ PunctuationDollarSign,
58
+ PunctuationAtSign
59
+ }
@@ -1,95 +1,95 @@
1
- "use strict";
2
- // The encoding for morse is much less straightforward than the others. The dots
3
- // and dashes each use two bits of the integer starting with the least-
4
- // significant bit.
5
- //
6
- // Example:
7
- //
8
- // 'F' -> ..-.
9
- //
10
- // Which encodes as:
11
- //
12
- // 01 01 10 01
13
- // . . - .
14
- //
15
- // Since it's packed starting with the LSB, the resulting number is reversed:
16
- //
17
- // 01100101 -> 0x65
18
- //
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.MorseEncoding = void 0;
21
- function packMorse(...args) {
22
- let value = MorseEncoding.None;
23
- let shift = 0;
24
- for (let arg of args) {
25
- arg <<= shift;
26
- value |= arg;
27
- shift += 2;
28
- }
29
- return value;
30
- }
31
- var MorseEncoding;
32
- (function (MorseEncoding) {
33
- MorseEncoding[MorseEncoding["None"] = 0] = "None";
34
- // Primitives
35
- MorseEncoding[MorseEncoding["Dot"] = 1] = "Dot";
36
- MorseEncoding[MorseEncoding["Dash"] = 2] = "Dash";
37
- // Letters
38
- MorseEncoding[MorseEncoding["LetterA"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterA";
39
- MorseEncoding[MorseEncoding["LetterB"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterB";
40
- MorseEncoding[MorseEncoding["LetterC"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterC";
41
- MorseEncoding[MorseEncoding["LetterD"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterD";
42
- MorseEncoding[MorseEncoding["LetterE"] = packMorse(MorseEncoding.Dot)] = "LetterE";
43
- MorseEncoding[MorseEncoding["LetterF"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterF";
44
- MorseEncoding[MorseEncoding["LetterG"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterG";
45
- MorseEncoding[MorseEncoding["LetterH"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterH";
46
- MorseEncoding[MorseEncoding["LetterI"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterI";
47
- MorseEncoding[MorseEncoding["LetterJ"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterJ";
48
- MorseEncoding[MorseEncoding["LetterK"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterK";
49
- MorseEncoding[MorseEncoding["LetterL"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterL";
50
- MorseEncoding[MorseEncoding["LetterM"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterM";
51
- MorseEncoding[MorseEncoding["LetterN"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterN";
52
- MorseEncoding[MorseEncoding["LetterO"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterO";
53
- MorseEncoding[MorseEncoding["LetterP"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterP";
54
- MorseEncoding[MorseEncoding["LetterQ"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterQ";
55
- MorseEncoding[MorseEncoding["LetterR"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterR";
56
- MorseEncoding[MorseEncoding["LetterS"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterS";
57
- MorseEncoding[MorseEncoding["LetterT"] = packMorse(MorseEncoding.Dash)] = "LetterT";
58
- MorseEncoding[MorseEncoding["LetterU"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterU";
59
- MorseEncoding[MorseEncoding["LetterV"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterV";
60
- MorseEncoding[MorseEncoding["LetterW"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterW";
61
- MorseEncoding[MorseEncoding["LetterX"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterX";
62
- MorseEncoding[MorseEncoding["LetterY"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterY";
63
- MorseEncoding[MorseEncoding["LetterZ"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterZ";
64
- // Numbers
65
- MorseEncoding[MorseEncoding["Number0"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number0";
66
- MorseEncoding[MorseEncoding["Number1"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number1";
67
- MorseEncoding[MorseEncoding["Number2"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number2";
68
- MorseEncoding[MorseEncoding["Number3"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number3";
69
- MorseEncoding[MorseEncoding["Number4"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "Number4";
70
- MorseEncoding[MorseEncoding["Number5"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number5";
71
- MorseEncoding[MorseEncoding["Number6"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number6";
72
- MorseEncoding[MorseEncoding["Number7"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number7";
73
- MorseEncoding[MorseEncoding["Number8"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number8";
74
- MorseEncoding[MorseEncoding["Number9"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "Number9";
75
- // Punctuation
76
- MorseEncoding[MorseEncoding["PunctuationPeriod"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationPeriod";
77
- MorseEncoding[MorseEncoding["PunctuationComma"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "PunctuationComma";
78
- MorseEncoding[MorseEncoding["PunctuationQuestionMark"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "PunctuationQuestionMark";
79
- MorseEncoding[MorseEncoding["PunctuationApostrophe"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationApostrophe";
80
- MorseEncoding[MorseEncoding["PunctuationExclamationPoint"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "PunctuationExclamationPoint";
81
- MorseEncoding[MorseEncoding["PunctuationForwardSlash"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationForwardSlash";
82
- MorseEncoding[MorseEncoding["PunctuationOpenParenthesis"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationOpenParenthesis";
83
- MorseEncoding[MorseEncoding["PunctuationCloseParenthesis"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationCloseParenthesis";
84
- MorseEncoding[MorseEncoding["PunctuationAmpersand"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "PunctuationAmpersand";
85
- MorseEncoding[MorseEncoding["PunctuationColon"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "PunctuationColon";
86
- MorseEncoding[MorseEncoding["PunctuationSemicolon"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationSemicolon";
87
- MorseEncoding[MorseEncoding["PunctuationDoubleDash"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationDoubleDash";
88
- MorseEncoding[MorseEncoding["PunctuationPlusSign"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationPlusSign";
89
- MorseEncoding[MorseEncoding["PunctuationHyphen"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationHyphen";
90
- MorseEncoding[MorseEncoding["PunctuationUnderscore"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationUnderscore";
91
- MorseEncoding[MorseEncoding["PunctuationQuotationMark"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationQuotationMark";
92
- MorseEncoding[MorseEncoding["PunctuationDollarSign"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationDollarSign";
93
- MorseEncoding[MorseEncoding["PunctuationAtSign"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationAtSign";
94
- })(MorseEncoding = exports.MorseEncoding || (exports.MorseEncoding = {}));
1
+ "use strict";
2
+ // The encoding for morse is much less straightforward than the others. The dots
3
+ // and dashes each use two bits of the integer starting with the least-
4
+ // significant bit.
5
+ //
6
+ // Example:
7
+ //
8
+ // 'F' -> ..-.
9
+ //
10
+ // Which encodes as:
11
+ //
12
+ // 01 01 10 01
13
+ // . . - .
14
+ //
15
+ // Since it's packed starting with the LSB, the resulting number is reversed:
16
+ //
17
+ // 01100101 -> 0x65
18
+ //
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.MorseEncoding = void 0;
21
+ function packMorse(...args) {
22
+ let value = MorseEncoding.None;
23
+ let shift = 0;
24
+ for (let arg of args) {
25
+ arg <<= shift;
26
+ value |= arg;
27
+ shift += 2;
28
+ }
29
+ return value;
30
+ }
31
+ var MorseEncoding;
32
+ (function (MorseEncoding) {
33
+ MorseEncoding[MorseEncoding["None"] = 0] = "None";
34
+ // Primitives
35
+ MorseEncoding[MorseEncoding["Dot"] = 1] = "Dot";
36
+ MorseEncoding[MorseEncoding["Dash"] = 2] = "Dash";
37
+ // Letters
38
+ MorseEncoding[MorseEncoding["LetterA"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterA";
39
+ MorseEncoding[MorseEncoding["LetterB"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterB";
40
+ MorseEncoding[MorseEncoding["LetterC"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterC";
41
+ MorseEncoding[MorseEncoding["LetterD"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterD";
42
+ MorseEncoding[MorseEncoding["LetterE"] = packMorse(MorseEncoding.Dot)] = "LetterE";
43
+ MorseEncoding[MorseEncoding["LetterF"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterF";
44
+ MorseEncoding[MorseEncoding["LetterG"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterG";
45
+ MorseEncoding[MorseEncoding["LetterH"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterH";
46
+ MorseEncoding[MorseEncoding["LetterI"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterI";
47
+ MorseEncoding[MorseEncoding["LetterJ"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterJ";
48
+ MorseEncoding[MorseEncoding["LetterK"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterK";
49
+ MorseEncoding[MorseEncoding["LetterL"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterL";
50
+ MorseEncoding[MorseEncoding["LetterM"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterM";
51
+ MorseEncoding[MorseEncoding["LetterN"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterN";
52
+ MorseEncoding[MorseEncoding["LetterO"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterO";
53
+ MorseEncoding[MorseEncoding["LetterP"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterP";
54
+ MorseEncoding[MorseEncoding["LetterQ"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterQ";
55
+ MorseEncoding[MorseEncoding["LetterR"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "LetterR";
56
+ MorseEncoding[MorseEncoding["LetterS"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterS";
57
+ MorseEncoding[MorseEncoding["LetterT"] = packMorse(MorseEncoding.Dash)] = "LetterT";
58
+ MorseEncoding[MorseEncoding["LetterU"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterU";
59
+ MorseEncoding[MorseEncoding["LetterV"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterV";
60
+ MorseEncoding[MorseEncoding["LetterW"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterW";
61
+ MorseEncoding[MorseEncoding["LetterX"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "LetterX";
62
+ MorseEncoding[MorseEncoding["LetterY"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "LetterY";
63
+ MorseEncoding[MorseEncoding["LetterZ"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "LetterZ";
64
+ // Numbers
65
+ MorseEncoding[MorseEncoding["Number0"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number0";
66
+ MorseEncoding[MorseEncoding["Number1"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number1";
67
+ MorseEncoding[MorseEncoding["Number2"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number2";
68
+ MorseEncoding[MorseEncoding["Number3"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "Number3";
69
+ MorseEncoding[MorseEncoding["Number4"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "Number4";
70
+ MorseEncoding[MorseEncoding["Number5"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number5";
71
+ MorseEncoding[MorseEncoding["Number6"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number6";
72
+ MorseEncoding[MorseEncoding["Number7"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number7";
73
+ MorseEncoding[MorseEncoding["Number8"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "Number8";
74
+ MorseEncoding[MorseEncoding["Number9"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "Number9";
75
+ // Punctuation
76
+ MorseEncoding[MorseEncoding["PunctuationPeriod"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationPeriod";
77
+ MorseEncoding[MorseEncoding["PunctuationComma"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "PunctuationComma";
78
+ MorseEncoding[MorseEncoding["PunctuationQuestionMark"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot)] = "PunctuationQuestionMark";
79
+ MorseEncoding[MorseEncoding["PunctuationApostrophe"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationApostrophe";
80
+ MorseEncoding[MorseEncoding["PunctuationExclamationPoint"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash)] = "PunctuationExclamationPoint";
81
+ MorseEncoding[MorseEncoding["PunctuationForwardSlash"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationForwardSlash";
82
+ MorseEncoding[MorseEncoding["PunctuationOpenParenthesis"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationOpenParenthesis";
83
+ MorseEncoding[MorseEncoding["PunctuationCloseParenthesis"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationCloseParenthesis";
84
+ MorseEncoding[MorseEncoding["PunctuationAmpersand"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "PunctuationAmpersand";
85
+ MorseEncoding[MorseEncoding["PunctuationColon"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot)] = "PunctuationColon";
86
+ MorseEncoding[MorseEncoding["PunctuationSemicolon"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationSemicolon";
87
+ MorseEncoding[MorseEncoding["PunctuationDoubleDash"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationDoubleDash";
88
+ MorseEncoding[MorseEncoding["PunctuationPlusSign"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationPlusSign";
89
+ MorseEncoding[MorseEncoding["PunctuationHyphen"] = packMorse(MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationHyphen";
90
+ MorseEncoding[MorseEncoding["PunctuationUnderscore"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationUnderscore";
91
+ MorseEncoding[MorseEncoding["PunctuationQuotationMark"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationQuotationMark";
92
+ MorseEncoding[MorseEncoding["PunctuationDollarSign"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dot, MorseEncoding.Dash)] = "PunctuationDollarSign";
93
+ MorseEncoding[MorseEncoding["PunctuationAtSign"] = packMorse(MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dash, MorseEncoding.Dot, MorseEncoding.Dash, MorseEncoding.Dot)] = "PunctuationAtSign";
94
+ })(MorseEncoding || (exports.MorseEncoding = MorseEncoding = {}));
95
95
  //# sourceMappingURL=MorseEncoding.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MorseEncoding.js","sourceRoot":"","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uDAAwB,SAAS,CAAC,cAAA,GAAG,EAAE,cAAA,GAAG,EAAE,cAAA,IAAI,EAAE,cAAA,IAAI,EAAE,cAAA,GAAG,EAAE,cAAA,IAAI,CAAC,2BAAA,CAAA;IAClE,0DAA2B,SAAS,CAAC,cAAA,GAAG,EAAE,cAAA,IAAI,EAAE,cAAA,GAAG,EAAE,cAAA,GAAG,EAAE,cAAA,IAAI,EAAE,cAAA,GAAG,CAAC,8BAAA,CAAA;IACpE,uDAAwB,SAAS,CAAC,cAAA,GAAG,EAAE,cAAA,GAAG,EAAE,cAAA,GAAG,EAAE,cAAA,IAAI,EAAE,cAAA,GAAG,EAAE,cAAA,GAAG,EAAE,cAAA,IAAI,CAAC,2BAAA,CAAA;IACtE,mDAAoB,SAAS,CAAC,cAAA,GAAG,EAAE,cAAA,IAAI,EAAE,cAAA,IAAI,EAAE,cAAA,GAAG,EAAE,cAAA,IAAI,EAAE,cAAA,GAAG,CAAC,uBAAA,CAAA;AAChE,CAAC,EAlEW,aAAa,6BAAb,aAAa,QAkExB"}
@@ -1,10 +1,10 @@
1
- import { MorseCharacter } from './MorseCharacter';
2
- export declare class MorseString {
3
- static readonly CHARACTER_DIVIDER: string;
4
- static readonly WORD_DIVIDER = " ";
5
- constructor(morse?: string, characterDivider?: string, wordDivider?: string);
6
- reverse(): MorseString;
7
- invertDotsAndDashes(): MorseString;
8
- toString(): string;
9
- protected _words: MorseCharacter[][];
10
- }
1
+ import { MorseCharacter } from './MorseCharacter';
2
+ export declare class MorseString {
3
+ static readonly CHARACTER_DIVIDER: string;
4
+ static readonly WORD_DIVIDER = " ";
5
+ constructor(morse?: string, characterDivider?: string, wordDivider?: string);
6
+ reverse(): MorseString;
7
+ invertDotsAndDashes(): MorseString;
8
+ toString(): string;
9
+ protected _words: MorseCharacter[][];
10
+ }
@@ -1,67 +1,68 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MorseString = void 0;
4
- const Helpers_1 = require("../Common/Helpers");
5
- const MorseCharacter_1 = require("./MorseCharacter");
6
- // MorseString represents a string of multiple morse characters. It allows for a longer representation
7
- // to be converted to a single string and allows for sentence-level transforms such as reversing
8
- // the order of tokens.
9
- class MorseString {
10
- constructor(morse = '', characterDivider = MorseString.CHARACTER_DIVIDER, wordDivider = MorseString.WORD_DIVIDER) {
11
- // The dividers should be single characters which don't clash with the other string content
12
- Helpers_1.Helpers.assertMsg(characterDivider.length === 1, 'Divider must be a single character');
13
- Helpers_1.Helpers.assertMsg(wordDivider.length === 1, 'Divider must be a single character');
14
- Helpers_1.Helpers.assertMsg(characterDivider !== wordDivider, 'Dividers must be different from each other');
15
- Helpers_1.Helpers.assertMsg(characterDivider !== MorseCharacter_1.MorseCharacter.DASH, 'Character divider must not be a reserved value');
16
- Helpers_1.Helpers.assertMsg(characterDivider !== MorseCharacter_1.MorseCharacter.DOT, 'Character divider must not be a reserved value');
17
- Helpers_1.Helpers.assertMsg(characterDivider !== MorseCharacter_1.MorseCharacter.RESERVED_DIVIDER, 'Character divider must not be a reserved value');
18
- Helpers_1.Helpers.assertMsg(wordDivider !== MorseCharacter_1.MorseCharacter.DASH, 'Word divider must not be a reserved value');
19
- Helpers_1.Helpers.assertMsg(wordDivider !== MorseCharacter_1.MorseCharacter.DOT, 'Word divider must not be a reserved value');
20
- Helpers_1.Helpers.assertMsg(wordDivider !== MorseCharacter_1.MorseCharacter.RESERVED_DIVIDER, 'Word divider must not be a reserved value');
21
- const words = morse.split(wordDivider).filter(w => w.length > 0);
22
- // Discard any empty characters (caused by trailing separator)
23
- const wordCharacters = words.map(w => w.split(characterDivider).filter(wc => wc.length > 0));
24
- this._words = wordCharacters.map(subarray => subarray.map(wc => new MorseCharacter_1.MorseCharacter(wc)));
25
- }
26
- // reverse reverses the order of all tokens in the string (including separators), such as would be
27
- // the case if you were reading the data for a puzzle backwards.
28
- reverse() {
29
- for (let i = 0; i < this._words.length; i++) {
30
- for (const c of this._words[i]) {
31
- // Reverse the dots/dashes in each letter
32
- c.reverse();
33
- }
34
- // Reverse the letters in each word
35
- this._words[i] = this._words[i].reverse();
36
- }
37
- // Reverse the order of the words
38
- this._words = this._words.reverse();
39
- return this;
40
- }
41
- // invertDotsAndDashes switches all dots and dashes in the input, such as would be the case if
42
- // you had two ambiguous symbols for dot/dash and selected the wrong mapping.
43
- invertDotsAndDashes() {
44
- for (const word of this._words) {
45
- for (const c of word) {
46
- c.invertDotsAndDashes();
47
- }
48
- }
49
- return this;
50
- }
51
- toString() {
52
- let s = '';
53
- for (let i = 0; i < this._words.length; i++) {
54
- if (i > 0) {
55
- s += ' '; // This is a new word
56
- }
57
- for (const c of this._words[i]) {
58
- s += c.toString() || '?';
59
- }
60
- }
61
- return s;
62
- }
63
- }
64
- exports.MorseString = MorseString;
65
- MorseString.CHARACTER_DIVIDER = '/';
66
- MorseString.WORD_DIVIDER = ' ';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MorseString = void 0;
4
+ const Helpers_1 = require("../Common/Helpers");
5
+ const MorseCharacter_1 = require("./MorseCharacter");
6
+ // MorseString represents a string of multiple morse characters. It allows for a longer representation
7
+ // to be converted to a single string and allows for sentence-level transforms such as reversing
8
+ // the order of tokens.
9
+ class MorseString {
10
+ static CHARACTER_DIVIDER = '/';
11
+ static WORD_DIVIDER = ' ';
12
+ constructor(morse = '', characterDivider = MorseString.CHARACTER_DIVIDER, wordDivider = MorseString.WORD_DIVIDER) {
13
+ // The dividers should be single characters which don't clash with the other string content
14
+ Helpers_1.Helpers.assertMsg(characterDivider.length === 1, 'Divider must be a single character');
15
+ Helpers_1.Helpers.assertMsg(wordDivider.length === 1, 'Divider must be a single character');
16
+ Helpers_1.Helpers.assertMsg(characterDivider !== wordDivider, 'Dividers must be different from each other');
17
+ Helpers_1.Helpers.assertMsg(characterDivider !== MorseCharacter_1.MorseCharacter.DASH, 'Character divider must not be a reserved value');
18
+ Helpers_1.Helpers.assertMsg(characterDivider !== MorseCharacter_1.MorseCharacter.DOT, 'Character divider must not be a reserved value');
19
+ Helpers_1.Helpers.assertMsg(characterDivider !== MorseCharacter_1.MorseCharacter.RESERVED_DIVIDER, 'Character divider must not be a reserved value');
20
+ Helpers_1.Helpers.assertMsg(wordDivider !== MorseCharacter_1.MorseCharacter.DASH, 'Word divider must not be a reserved value');
21
+ Helpers_1.Helpers.assertMsg(wordDivider !== MorseCharacter_1.MorseCharacter.DOT, 'Word divider must not be a reserved value');
22
+ Helpers_1.Helpers.assertMsg(wordDivider !== MorseCharacter_1.MorseCharacter.RESERVED_DIVIDER, 'Word divider must not be a reserved value');
23
+ const words = morse.split(wordDivider).filter(w => w.length > 0);
24
+ // Discard any empty characters (caused by trailing separator)
25
+ const wordCharacters = words.map(w => w.split(characterDivider).filter(wc => wc.length > 0));
26
+ this._words = wordCharacters.map(subarray => subarray.map(wc => new MorseCharacter_1.MorseCharacter(wc)));
27
+ }
28
+ // reverse reverses the order of all tokens in the string (including separators), such as would be
29
+ // the case if you were reading the data for a puzzle backwards.
30
+ reverse() {
31
+ for (let i = 0; i < this._words.length; i++) {
32
+ for (const c of this._words[i]) {
33
+ // Reverse the dots/dashes in each letter
34
+ c.reverse();
35
+ }
36
+ // Reverse the letters in each word
37
+ this._words[i] = this._words[i].reverse();
38
+ }
39
+ // Reverse the order of the words
40
+ this._words = this._words.reverse();
41
+ return this;
42
+ }
43
+ // invertDotsAndDashes switches all dots and dashes in the input, such as would be the case if
44
+ // you had two ambiguous symbols for dot/dash and selected the wrong mapping.
45
+ invertDotsAndDashes() {
46
+ for (const word of this._words) {
47
+ for (const c of word) {
48
+ c.invertDotsAndDashes();
49
+ }
50
+ }
51
+ return this;
52
+ }
53
+ toString() {
54
+ let s = '';
55
+ for (let i = 0; i < this._words.length; i++) {
56
+ if (i > 0) {
57
+ s += ' '; // This is a new word
58
+ }
59
+ for (const c of this._words[i]) {
60
+ s += c.toString() || '?';
61
+ }
62
+ }
63
+ return s;
64
+ }
65
+ _words;
66
+ }
67
+ exports.MorseString = MorseString;
67
68
  //# sourceMappingURL=MorseString.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MorseString.js","sourceRoot":"","sources":["../../../src/Morse/MorseString.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,qDAAgD;AAEhD,uGAAuG;AACvG,gGAAgG;AAChG,uBAAuB;AACvB,MAAa,WAAW;IAItB,YACE,KAAK,GAAG,EAAE,EACV,gBAAgB,GAAG,WAAW,CAAC,iBAAiB,EAChD,WAAW,GAAG,WAAW,CAAC,YAAY;QAEtC,2FAA2F;QAC3F,iBAAO,CAAC,SAAS,CACf,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAC7B,oCAAoC,CACrC,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,WAAW,CAAC,MAAM,KAAK,CAAC,EACxB,oCAAoC,CACrC,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,gBAAgB,KAAK,WAAW,EAChC,4CAA4C,CAC7C,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,gBAAgB,KAAK,+BAAc,CAAC,IAAI,EACxC,gDAAgD,CACjD,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,gBAAgB,KAAK,+BAAc,CAAC,GAAG,EACvC,gDAAgD,CACjD,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,gBAAgB,KAAK,+BAAc,CAAC,gBAAgB,EACpD,gDAAgD,CACjD,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,WAAW,KAAK,+BAAc,CAAC,IAAI,EACnC,2CAA2C,CAC5C,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,WAAW,KAAK,+BAAc,CAAC,GAAG,EAClC,2CAA2C,CAC5C,CAAC;QACF,iBAAO,CAAC,SAAS,CACf,WAAW,KAAK,+BAAc,CAAC,gBAAgB,EAC/C,2CAA2C,CAC5C,CAAC;QAEF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EA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AC,OAAO,EAAE,CAAC;aACb;YACD,mCAAmC;YACnC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC3C;QAED,iCAAiC;QACjC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8FAA8F;IAC9F,6EAA6E;IAC7E,mBAAmB;QACjB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YAC9B,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;gBACpB,CAAC,CAAC,mBAAmB,EAAE,CAAC;aACzB;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC3C,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,CAAC,IAAI,GAAG,CAAC,CAAC,qBAAqB;aAChC;YACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;gBAC9B,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC;aAC1B;SACF;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAES,MAAM,CAAqB;;AAlGvC,kCAmGC"}
@@ -1,5 +1,5 @@
1
- export declare class NatoCharacter {
2
- readonly character: string;
3
- readonly word: string;
4
- constructor(character: string, word: string);
5
- }
1
+ export declare class NatoCharacter {
2
+ readonly character: string;
3
+ readonly word: string;
4
+ constructor(character: string, word: string);
5
+ }
@@ -1,11 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NatoCharacter = void 0;
4
- class NatoCharacter {
5
- constructor(character, word) {
6
- this.character = character;
7
- this.word = word;
8
- }
9
- }
10
- exports.NatoCharacter = NatoCharacter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NatoCharacter = void 0;
4
+ class NatoCharacter {
5
+ character;
6
+ word;
7
+ constructor(character, word) {
8
+ this.character = character;
9
+ this.word = word;
10
+ }
11
+ }
12
+ exports.NatoCharacter = NatoCharacter;
11
13
  //# sourceMappingURL=NatoCharacter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NatoCharacter.js","sourceRoot":"","sources":["../../../src/Nato/NatoCharacter.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IAIxB,YAAY,SAAiB,EAAE,IAAY;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,sCAQC"}
1
+ {"version":3,"file":"NatoCharacter.js","sourceRoot":"","sources":["../../../src/Nato/NatoCharacter.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IACf,SAAS,CAAS;IAClB,IAAI,CAAS;IAEtB,YAAY,SAAiB,EAAE,IAAY;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,sCAQC"}
@@ -1,7 +1,7 @@
1
- import { NatoCharacter } from './NatoCharacter';
2
- export declare class NatoData {
3
- static readonly instance: NatoData;
4
- private readonly _entries;
5
- get entries(): NatoCharacter[];
6
- lookup(letter: string): NatoCharacter | null;
7
- }
1
+ import { NatoCharacter } from './NatoCharacter';
2
+ export declare class NatoData {
3
+ static readonly instance: NatoData;
4
+ private readonly _entries;
5
+ get entries(): NatoCharacter[];
6
+ lookup(letter: string): NatoCharacter | null;
7
+ }