metar-taf-parser 1.2.0 → 2.0.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 (121) hide show
  1. package/README.md +85 -12
  2. package/dist/command/common.js +13 -10
  3. package/dist/command/metar/AltimeterCommand.d.ts +7 -0
  4. package/dist/command/metar/AltimeterCommand.js +26 -0
  5. package/dist/command/metar/AltimeterMercuryCommand.d.ts +7 -0
  6. package/dist/command/metar/AltimeterMercuryCommand.js +51 -0
  7. package/dist/command/metar/RunwayCommand.d.ts +7 -0
  8. package/dist/command/metar/RunwayCommand.js +60 -0
  9. package/dist/command/metar/TemperatureCommand.d.ts +7 -0
  10. package/dist/command/metar/TemperatureCommand.js +51 -0
  11. package/dist/command/metar.d.ts +1 -22
  12. package/dist/command/metar.js +10 -113
  13. package/dist/command/remark/CeilingHeightCommand.d.ts +18 -0
  14. package/dist/command/remark/CeilingHeightCommand.js +40 -0
  15. package/dist/command/remark/CeilingSecondLocationCommand.d.ts +12 -0
  16. package/dist/command/remark/CeilingSecondLocationCommand.js +40 -0
  17. package/dist/command/remark/Command.d.ts +8 -0
  18. package/dist/command/remark/Command.js +9 -0
  19. package/dist/command/remark/DefaultCommand.d.ts +11 -0
  20. package/dist/command/remark/DefaultCommand.js +38 -0
  21. package/dist/command/remark/HailSizeCommand.d.ts +11 -0
  22. package/dist/command/remark/HailSizeCommand.js +37 -0
  23. package/dist/command/remark/HourlyMaximumMinimumTemperatureCommand.d.ts +18 -0
  24. package/dist/command/remark/HourlyMaximumMinimumTemperatureCommand.js +39 -0
  25. package/dist/command/remark/HourlyMaximumTemperatureCommand.d.ts +14 -0
  26. package/dist/command/remark/HourlyMaximumTemperatureCommand.js +38 -0
  27. package/dist/command/remark/HourlyMinimumTemperatureCommand.d.ts +14 -0
  28. package/dist/command/remark/HourlyMinimumTemperatureCommand.js +38 -0
  29. package/dist/command/remark/HourlyPrecipitationAmountCommand.d.ts +14 -0
  30. package/dist/command/remark/HourlyPrecipitationAmountCommand.js +38 -0
  31. package/dist/command/remark/HourlyPressureCommand.d.ts +32 -0
  32. package/dist/command/remark/HourlyPressureCommand.js +40 -0
  33. package/dist/command/remark/HourlyTemperatureDewPointCommand.d.ts +18 -0
  34. package/dist/command/remark/HourlyTemperatureDewPointCommand.js +52 -0
  35. package/dist/command/remark/IceAccretionCommand.d.ts +15 -0
  36. package/dist/command/remark/IceAccretionCommand.js +38 -0
  37. package/dist/command/remark/ObscurationCommand.d.ts +14 -0
  38. package/dist/command/remark/ObscurationCommand.js +44 -0
  39. package/dist/command/remark/PrecipitationAmount24HourCommand.d.ts +14 -0
  40. package/dist/command/remark/PrecipitationAmount24HourCommand.js +39 -0
  41. package/dist/command/remark/PrecipitationAmount36HourCommand.d.ts +15 -0
  42. package/dist/command/remark/PrecipitationAmount36HourCommand.js +41 -0
  43. package/dist/command/remark/PrecipitationBegCommand.d.ts +15 -0
  44. package/dist/command/remark/PrecipitationBegCommand.js +45 -0
  45. package/dist/command/remark/PrecipitationBegEndCommand.d.ts +17 -0
  46. package/dist/command/remark/PrecipitationBegEndCommand.js +46 -0
  47. package/dist/command/remark/PrecipitationEndCommand.d.ts +15 -0
  48. package/dist/command/remark/PrecipitationEndCommand.js +45 -0
  49. package/dist/command/remark/PrevailingVisibilityCommand.d.ts +12 -0
  50. package/dist/command/remark/PrevailingVisibilityCommand.js +40 -0
  51. package/dist/command/remark/SeaLevelPressureCommand.d.ts +11 -0
  52. package/dist/command/remark/SeaLevelPressureCommand.js +39 -0
  53. package/dist/command/remark/SecondLocationVisibilityCommand.d.ts +12 -0
  54. package/dist/command/remark/SecondLocationVisibilityCommand.js +40 -0
  55. package/dist/command/remark/SectorVisibilityCommand.d.ts +13 -0
  56. package/dist/command/remark/SectorVisibilityCommand.js +41 -0
  57. package/dist/command/remark/SmallHailSizeCommand.d.ts +11 -0
  58. package/dist/command/remark/SmallHailSizeCommand.js +37 -0
  59. package/dist/command/remark/SnowDepthCommand.d.ts +11 -0
  60. package/dist/command/remark/SnowDepthCommand.js +38 -0
  61. package/dist/command/remark/SnowIncreaseCommand.d.ts +12 -0
  62. package/dist/command/remark/SnowIncreaseCommand.js +40 -0
  63. package/dist/command/remark/SnowPelletsCommand.d.ts +11 -0
  64. package/dist/command/remark/SnowPelletsCommand.js +37 -0
  65. package/dist/command/remark/SunshineDurationCommand.d.ts +11 -0
  66. package/dist/command/remark/SunshineDurationCommand.js +38 -0
  67. package/dist/command/remark/SurfaceVisibilityCommand.d.ts +11 -0
  68. package/dist/command/remark/SurfaceVisibilityCommand.js +38 -0
  69. package/dist/command/remark/ThunderStormLocationCommand.d.ts +12 -0
  70. package/dist/command/remark/ThunderStormLocationCommand.js +40 -0
  71. package/dist/command/remark/ThunderStormLocationMovingCommand.d.ts +19 -0
  72. package/dist/command/remark/ThunderStormLocationMovingCommand.js +42 -0
  73. package/dist/command/remark/TornadicActivityBegCommand.d.ts +16 -0
  74. package/dist/command/remark/TornadicActivityBegCommand.js +44 -0
  75. package/dist/command/remark/TornadicActivityBegEndCommand.d.ts +18 -0
  76. package/dist/command/remark/TornadicActivityBegEndCommand.js +46 -0
  77. package/dist/command/remark/TornadicActivityEndCommand.d.ts +16 -0
  78. package/dist/command/remark/TornadicActivityEndCommand.js +44 -0
  79. package/dist/command/remark/TowerVisibilityCommand.d.ts +11 -0
  80. package/dist/command/remark/TowerVisibilityCommand.js +38 -0
  81. package/dist/command/remark/VariableSkyCommand.d.ts +12 -0
  82. package/dist/command/remark/VariableSkyCommand.js +41 -0
  83. package/dist/command/remark/VariableSkyHeightCommand.d.ts +13 -0
  84. package/dist/command/remark/VariableSkyHeightCommand.js +43 -0
  85. package/dist/command/remark/VirgaDirectionCommand.d.ts +12 -0
  86. package/dist/command/remark/VirgaDirectionCommand.js +40 -0
  87. package/dist/command/remark/WaterEquivalentSnowCommand.d.ts +11 -0
  88. package/dist/command/remark/WaterEquivalentSnowCommand.js +38 -0
  89. package/dist/command/remark/WindPeakCommandCommand.d.ts +17 -0
  90. package/dist/command/remark/WindPeakCommandCommand.js +42 -0
  91. package/dist/command/remark/WindShiftCommand.d.ts +12 -0
  92. package/dist/command/remark/WindShiftCommand.js +38 -0
  93. package/dist/command/remark/WindShiftFropaCommand.d.ts +12 -0
  94. package/dist/command/remark/WindShiftFropaCommand.js +38 -0
  95. package/dist/command/remark.d.ts +100 -194
  96. package/dist/command/remark.js +135 -753
  97. package/dist/commons/converter.d.ts +14 -2
  98. package/dist/commons/converter.js +53 -5
  99. package/dist/commons/errors.d.ts +6 -2
  100. package/dist/commons/errors.js +15 -8
  101. package/dist/commons/i18n.d.ts +2 -2
  102. package/dist/commons/i18n.js +9 -3
  103. package/dist/dates/metar.d.ts +5 -0
  104. package/dist/dates/metar.js +8 -0
  105. package/dist/dates/taf.d.ts +28 -0
  106. package/dist/dates/taf.js +17 -0
  107. package/dist/forecast/forecast.d.ts +36 -0
  108. package/dist/forecast/forecast.js +73 -0
  109. package/dist/helpers/date.d.ts +11 -0
  110. package/dist/helpers/date.js +56 -0
  111. package/dist/helpers/helpers.d.ts +7 -0
  112. package/dist/helpers/helpers.js +14 -1
  113. package/dist/index.d.ts +23 -2
  114. package/dist/index.js +24 -7
  115. package/dist/model/enum.d.ts +44 -0
  116. package/dist/model/enum.js +50 -1
  117. package/dist/model/model.d.ts +84 -19
  118. package/dist/model/model.js +3 -1
  119. package/dist/parser/parser.d.ts +13 -6
  120. package/dist/parser/parser.js +63 -29
  121. package/package.json +3 -3
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _VariableSkyCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.VariableSkyCommand = void 0;
10
+ const helpers_1 = require("../../helpers/helpers");
11
+ const i18n_1 = require("../../commons/i18n");
12
+ const errors_1 = require("../../commons/errors");
13
+ const enum_1 = require("../../model/enum");
14
+ const remark_1 = require("../remark");
15
+ const Command_1 = require("./Command");
16
+ class VariableSkyCommand extends Command_1.Command {
17
+ constructor() {
18
+ super(...arguments);
19
+ _VariableSkyCommand_regex.set(this, /^([A-Z]{3}) V ([A-Z]{3})/);
20
+ }
21
+ canParse(code) {
22
+ return __classPrivateFieldGet(this, _VariableSkyCommand_regex, "f").test(code);
23
+ }
24
+ execute(code, remark) {
25
+ const matches = code.match(__classPrivateFieldGet(this, _VariableSkyCommand_regex, "f"));
26
+ if (!matches)
27
+ throw new errors_1.UnexpectedParseError("Match not found");
28
+ const firstQuantity = (0, helpers_1.as)(matches[1], enum_1.CloudQuantity);
29
+ const secondQuantity = (0, helpers_1.as)(matches[2], enum_1.CloudQuantity);
30
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.Variable.Sky.Condition.0", this.locale), (0, i18n_1._)(`CloudQuantity.${firstQuantity}`, this.locale), (0, i18n_1._)(`CloudQuantity.${secondQuantity}`, this.locale));
31
+ remark.push({
32
+ type: remark_1.RemarkType.VariableSky,
33
+ description,
34
+ raw: matches[0],
35
+ cloudQuantityRange: [firstQuantity, secondQuantity],
36
+ });
37
+ return [code.replace(__classPrivateFieldGet(this, _VariableSkyCommand_regex, "f"), "").trim(), remark];
38
+ }
39
+ }
40
+ exports.VariableSkyCommand = VariableSkyCommand;
41
+ _VariableSkyCommand_regex = new WeakMap();
@@ -0,0 +1,13 @@
1
+ import { CloudQuantity } from "../../model/enum";
2
+ import { IBaseRemark, RemarkType, Remark } from "../remark";
3
+ import { Command } from "./Command";
4
+ export interface IVariableSkyHeightRemark extends IBaseRemark {
5
+ type: RemarkType.VariableSkyHeight;
6
+ height: number;
7
+ cloudQuantityRange: [CloudQuantity, CloudQuantity];
8
+ }
9
+ export declare class VariableSkyHeightCommand extends Command {
10
+ #private;
11
+ canParse(code: string): boolean;
12
+ execute(code: string, remark: Remark[]): [string, Remark[]];
13
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _VariableSkyHeightCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.VariableSkyHeightCommand = void 0;
10
+ const helpers_1 = require("../../helpers/helpers");
11
+ const i18n_1 = require("../../commons/i18n");
12
+ const errors_1 = require("../../commons/errors");
13
+ const enum_1 = require("../../model/enum");
14
+ const remark_1 = require("../remark");
15
+ const Command_1 = require("./Command");
16
+ class VariableSkyHeightCommand extends Command_1.Command {
17
+ constructor() {
18
+ super(...arguments);
19
+ _VariableSkyHeightCommand_regex.set(this, /^([A-Z]{3})(\d{3}) V ([A-Z]{3})/);
20
+ }
21
+ canParse(code) {
22
+ return __classPrivateFieldGet(this, _VariableSkyHeightCommand_regex, "f").test(code);
23
+ }
24
+ execute(code, remark) {
25
+ const matches = code.match(__classPrivateFieldGet(this, _VariableSkyHeightCommand_regex, "f"));
26
+ if (!matches)
27
+ throw new errors_1.UnexpectedParseError("Match not found");
28
+ const firstQuantity = (0, helpers_1.as)(matches[1], enum_1.CloudQuantity);
29
+ const secondQuantity = (0, helpers_1.as)(matches[3], enum_1.CloudQuantity);
30
+ const height = 100 * +matches[2];
31
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.Variable.Sky.Condition.Height", this.locale), height, (0, i18n_1._)(`CloudQuantity.${firstQuantity}`, this.locale), (0, i18n_1._)(`CloudQuantity.${secondQuantity}`, this.locale));
32
+ remark.push({
33
+ type: remark_1.RemarkType.VariableSkyHeight,
34
+ description,
35
+ raw: matches[0],
36
+ height,
37
+ cloudQuantityRange: [firstQuantity, secondQuantity],
38
+ });
39
+ return [code.replace(__classPrivateFieldGet(this, _VariableSkyHeightCommand_regex, "f"), "").trim(), remark];
40
+ }
41
+ }
42
+ exports.VariableSkyHeightCommand = VariableSkyHeightCommand;
43
+ _VariableSkyHeightCommand_regex = new WeakMap();
@@ -0,0 +1,12 @@
1
+ import { Direction } from "../../model/enum";
2
+ import { IBaseRemark, RemarkType, Remark } from "../remark";
3
+ import { Command } from "./Command";
4
+ export interface IVirgaDirectionRemark extends IBaseRemark {
5
+ type: RemarkType.VirgaDirection;
6
+ direction: Direction;
7
+ }
8
+ export declare class VirgaDirectionCommand extends Command {
9
+ #private;
10
+ canParse(code: string): boolean;
11
+ execute(code: string, remark: Remark[]): [string, Remark[]];
12
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _VirgaDirectionCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.VirgaDirectionCommand = void 0;
10
+ const helpers_1 = require("../../helpers/helpers");
11
+ const i18n_1 = require("../../commons/i18n");
12
+ const errors_1 = require("../../commons/errors");
13
+ const enum_1 = require("../../model/enum");
14
+ const remark_1 = require("../remark");
15
+ const Command_1 = require("./Command");
16
+ class VirgaDirectionCommand extends Command_1.Command {
17
+ constructor() {
18
+ super(...arguments);
19
+ _VirgaDirectionCommand_regex.set(this, /^VIRGA ([A-Z]{2})/);
20
+ }
21
+ canParse(code) {
22
+ return __classPrivateFieldGet(this, _VirgaDirectionCommand_regex, "f").test(code);
23
+ }
24
+ execute(code, remark) {
25
+ const matches = code.match(__classPrivateFieldGet(this, _VirgaDirectionCommand_regex, "f"));
26
+ if (!matches)
27
+ throw new errors_1.UnexpectedParseError("Match not found");
28
+ const direction = (0, helpers_1.as)(matches[1], enum_1.Direction);
29
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.Virga.Direction", this.locale), (0, i18n_1._)(`Converter.${direction}`, this.locale));
30
+ remark.push({
31
+ type: remark_1.RemarkType.VirgaDirection,
32
+ description,
33
+ raw: matches[0],
34
+ direction,
35
+ });
36
+ return [code.replace(__classPrivateFieldGet(this, _VirgaDirectionCommand_regex, "f"), "").trim(), remark];
37
+ }
38
+ }
39
+ exports.VirgaDirectionCommand = VirgaDirectionCommand;
40
+ _VirgaDirectionCommand_regex = new WeakMap();
@@ -0,0 +1,11 @@
1
+ import { IBaseRemark, RemarkType, Remark } from "../remark";
2
+ import { Command } from "./Command";
3
+ export interface IWaterEquivalentSnowRemark extends IBaseRemark {
4
+ type: RemarkType.WaterEquivalentSnow;
5
+ amount: number;
6
+ }
7
+ export declare class WaterEquivalentSnowCommand extends Command {
8
+ #private;
9
+ canParse(code: string): boolean;
10
+ execute(code: string, remark: Remark[]): [string, Remark[]];
11
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _WaterEquivalentSnowCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WaterEquivalentSnowCommand = void 0;
10
+ const i18n_1 = require("../../commons/i18n");
11
+ const errors_1 = require("../../commons/errors");
12
+ const remark_1 = require("../remark");
13
+ const Command_1 = require("./Command");
14
+ class WaterEquivalentSnowCommand extends Command_1.Command {
15
+ constructor() {
16
+ super(...arguments);
17
+ _WaterEquivalentSnowCommand_regex.set(this, /^933(\d{3})\b/);
18
+ }
19
+ canParse(code) {
20
+ return __classPrivateFieldGet(this, _WaterEquivalentSnowCommand_regex, "f").test(code);
21
+ }
22
+ execute(code, remark) {
23
+ const matches = code.match(__classPrivateFieldGet(this, _WaterEquivalentSnowCommand_regex, "f"));
24
+ if (!matches)
25
+ throw new errors_1.UnexpectedParseError("Match not found");
26
+ const amount = +matches[1] / 10;
27
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.Water.Equivalent.Snow.Ground", this.locale), amount);
28
+ remark.push({
29
+ type: remark_1.RemarkType.WaterEquivalentSnow,
30
+ description,
31
+ raw: matches[0],
32
+ amount,
33
+ });
34
+ return [code.replace(__classPrivateFieldGet(this, _WaterEquivalentSnowCommand_regex, "f"), "").trim(), remark];
35
+ }
36
+ }
37
+ exports.WaterEquivalentSnowCommand = WaterEquivalentSnowCommand;
38
+ _WaterEquivalentSnowCommand_regex = new WeakMap();
@@ -0,0 +1,17 @@
1
+ import { IBaseRemark, RemarkType, Remark } from "../remark";
2
+ import { Command } from "./Command";
3
+ export interface IWindPeakCommandRemark extends IBaseRemark {
4
+ type: RemarkType.WindPeak;
5
+ /**
6
+ * In knots
7
+ */
8
+ speed: number;
9
+ degrees: number;
10
+ startHour?: number;
11
+ startMinute: number;
12
+ }
13
+ export declare class WindPeakCommand extends Command {
14
+ #private;
15
+ canParse(code: string): boolean;
16
+ execute(code: string, remark: Remark[]): [string, Remark[]];
17
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _WindPeakCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WindPeakCommand = void 0;
10
+ const i18n_1 = require("../../commons/i18n");
11
+ const errors_1 = require("../../commons/errors");
12
+ const remark_1 = require("../remark");
13
+ const Command_1 = require("./Command");
14
+ class WindPeakCommand extends Command_1.Command {
15
+ constructor() {
16
+ super(...arguments);
17
+ _WindPeakCommand_regex.set(this, /^PK WND (\d{3})(\d{2,3})\/(\d{2})?(\d{2})/);
18
+ }
19
+ canParse(code) {
20
+ return __classPrivateFieldGet(this, _WindPeakCommand_regex, "f").test(code);
21
+ }
22
+ execute(code, remark) {
23
+ const matches = code.match(__classPrivateFieldGet(this, _WindPeakCommand_regex, "f"));
24
+ if (!matches)
25
+ throw new errors_1.UnexpectedParseError("Match not found");
26
+ const degrees = +matches[1];
27
+ const speed = +matches[2];
28
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.PeakWind", this.locale), degrees, speed, matches[3] || "", matches[4]);
29
+ remark.push({
30
+ type: remark_1.RemarkType.WindPeak,
31
+ description,
32
+ raw: matches[0],
33
+ speed,
34
+ degrees,
35
+ startHour: matches[3] ? +matches[3] : undefined,
36
+ startMinute: +matches[4],
37
+ });
38
+ return [code.replace(__classPrivateFieldGet(this, _WindPeakCommand_regex, "f"), "").trim(), remark];
39
+ }
40
+ }
41
+ exports.WindPeakCommand = WindPeakCommand;
42
+ _WindPeakCommand_regex = new WeakMap();
@@ -0,0 +1,12 @@
1
+ import { IBaseRemark, RemarkType, Remark } from "../remark";
2
+ import { Command } from "./Command";
3
+ export interface IWindShiftRemark extends IBaseRemark {
4
+ type: RemarkType.WindShift;
5
+ startHour?: number;
6
+ startMinute: number;
7
+ }
8
+ export declare class WindShiftCommand extends Command {
9
+ #private;
10
+ canParse(code: string): boolean;
11
+ execute(code: string, remark: Remark[]): [string, Remark[]];
12
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _WindShiftCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WindShiftCommand = void 0;
10
+ const i18n_1 = require("../../commons/i18n");
11
+ const errors_1 = require("../../commons/errors");
12
+ const remark_1 = require("../remark");
13
+ const Command_1 = require("./Command");
14
+ class WindShiftCommand extends Command_1.Command {
15
+ constructor() {
16
+ super(...arguments);
17
+ _WindShiftCommand_regex.set(this, /^WSHFT (\d{2})?(\d{2})/);
18
+ }
19
+ canParse(code) {
20
+ return __classPrivateFieldGet(this, _WindShiftCommand_regex, "f").test(code);
21
+ }
22
+ execute(code, remark) {
23
+ const matches = code.match(__classPrivateFieldGet(this, _WindShiftCommand_regex, "f"));
24
+ if (!matches)
25
+ throw new errors_1.UnexpectedParseError("Match not found");
26
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.WindShift.0", this.locale), matches[1] || "", matches[2]);
27
+ remark.push({
28
+ type: remark_1.RemarkType.WindShift,
29
+ description,
30
+ raw: matches[0],
31
+ startHour: matches[1] ? +matches[1] : undefined,
32
+ startMinute: +matches[2],
33
+ });
34
+ return [code.replace(__classPrivateFieldGet(this, _WindShiftCommand_regex, "f"), "").trim(), remark];
35
+ }
36
+ }
37
+ exports.WindShiftCommand = WindShiftCommand;
38
+ _WindShiftCommand_regex = new WeakMap();
@@ -0,0 +1,12 @@
1
+ import { IBaseRemark, RemarkType, Remark } from "../remark";
2
+ import { Command } from "./Command";
3
+ export interface IWindShiftFropaRemark extends IBaseRemark {
4
+ type: RemarkType.WindShiftFropa;
5
+ startHour?: number;
6
+ startMinute: number;
7
+ }
8
+ export declare class WindShiftFropaCommand extends Command {
9
+ #private;
10
+ canParse(code: string): boolean;
11
+ execute(code: string, remark: Remark[]): [string, Remark[]];
12
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _WindShiftFropaCommand_regex;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WindShiftFropaCommand = void 0;
10
+ const i18n_1 = require("../../commons/i18n");
11
+ const errors_1 = require("../../commons/errors");
12
+ const remark_1 = require("../remark");
13
+ const Command_1 = require("./Command");
14
+ class WindShiftFropaCommand extends Command_1.Command {
15
+ constructor() {
16
+ super(...arguments);
17
+ _WindShiftFropaCommand_regex.set(this, /^WSHFT (\d{2})?(\d{2}) FROPA/);
18
+ }
19
+ canParse(code) {
20
+ return __classPrivateFieldGet(this, _WindShiftFropaCommand_regex, "f").test(code);
21
+ }
22
+ execute(code, remark) {
23
+ const matches = code.match(__classPrivateFieldGet(this, _WindShiftFropaCommand_regex, "f"));
24
+ if (!matches)
25
+ throw new errors_1.UnexpectedParseError("Match not found");
26
+ const description = (0, i18n_1.format)((0, i18n_1._)("Remark.WindShift.FROPA", this.locale), matches[1] || "", matches[2]);
27
+ remark.push({
28
+ type: remark_1.RemarkType.WindShiftFropa,
29
+ description,
30
+ raw: matches[0],
31
+ startHour: matches[1] ? +matches[1] : undefined,
32
+ startMinute: +matches[2],
33
+ });
34
+ return [code.replace(__classPrivateFieldGet(this, _WindShiftFropaCommand_regex, "f"), "").trim(), remark];
35
+ }
36
+ }
37
+ exports.WindShiftFropaCommand = WindShiftFropaCommand;
38
+ _WindShiftFropaCommand_regex = new WeakMap();