metar-taf-parser 6.0.0 → 6.1.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.
@@ -242,6 +242,11 @@ declare enum DistanceUnit {
242
242
  Meters = "m",
243
243
  StatuteMiles = "SM"
244
244
  }
245
+ declare enum SpeedUnit {
246
+ Knot = "KT",
247
+ MetersPerSecond = "MPS",
248
+ KilometersPerHour = "KM/H"
249
+ }
245
250
  /**
246
251
  * Used to indicate the actual value is greater than or less than the value written
247
252
  *
@@ -1052,7 +1057,7 @@ interface IWind {
1052
1057
  gust?: number;
1053
1058
  minVariation?: number;
1054
1059
  maxVariation?: number;
1055
- unit: string;
1060
+ unit: SpeedUnit;
1056
1061
  }
1057
1062
  interface IWindShear extends IWind {
1058
1063
  height: number;
@@ -1372,4 +1377,4 @@ declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptions): ITA
1372
1377
  declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptionsDated): ITAFDated;
1373
1378
  declare function parseTAFAsForecast(rawTAF: string, options: IMetarTAFParserOptionsDated): IForecastContainer;
1374
1379
 
1375
- export { CloudQuantity, CloudType, CommandExecutionError, Descriptive, Direction, Distance, DistanceUnit, Forecast, IAbstractTrend, IAbstractValidity, IAbstractWeatherCode, IAbstractWeatherCodeDated, IAbstractWeatherContainer, IAirport, IBaseRemark, IBaseTAFTrend, ICeilingHeightRemark, ICeilingSecondLocationRemark, ICloud, ICompositeForecast, ICountry, IEndValidity, IFMValidity, IFlags, IForecastContainer, IHourlyMaximumMinimumTemperatureRemark, IHourlyMaximumTemperatureRemark, IHourlyMinimumTemperatureRemark, IHourlyPrecipitationAmountRemark, IHourlyPressureRemark, IHourlyTemperatureDewPointRemark, IIceAccretionRemark, IMetar, IMetarTAFParserOptions, IMetarTAFParserOptionsDated, IMetarTrend, IMetarTrendTime, IObscurationRemark, IPrecipitationAmount24HourRemark, IPrecipitationAmount36HourRemark, IPrecipitationBegEndRemark, IPrevailingVisibilityRemark, IRunwayInfo, ISeaLevelPressureRemark, ISecondLocationVisibilityRemark, ISectorVisibilityRemark, ISmallHailSizeRemark, ISnowIncreaseRemark, ISnowPelletsRemark, ISunshineDurationRemark, ISurfaceVisibilityRemark, ITAF, ITAFDated, ITemperature, ITemperatureDated, IThunderStormLocationMovingRemark, IThunderStormLocationRemark, ITime, ITornadicActivityBegEndRemark, ITornadicActivityBegRemark, ITornadicActivityEndRemark, ITowerVisibilityRemark, IUnknownRemark, IValidity, IValidityDated, IVariableSkyHeightRemark, IVariableSkyRemark, IVirgaDirectionRemark, IWaterEquivalentSnowRemark, IWeatherCondition, IWind, IWindPeakCommandRemark, IWindShear, IWindShiftFropaRemark, Intensity, InvalidWeatherStatementError, Locale, ParseError, Phenomenon, Remark, RemarkType, RunwayInfoTrend, RunwayInfoUnit, TAFTrend, TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, UnexpectedParseError, ValueIndicator, Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
1380
+ export { CloudQuantity, CloudType, CommandExecutionError, Descriptive, Direction, Distance, DistanceUnit, Forecast, IAbstractTrend, IAbstractValidity, IAbstractWeatherCode, IAbstractWeatherCodeDated, IAbstractWeatherContainer, IAirport, IBaseRemark, IBaseTAFTrend, ICeilingHeightRemark, ICeilingSecondLocationRemark, ICloud, ICompositeForecast, ICountry, IEndValidity, IFMValidity, IFlags, IForecastContainer, IHourlyMaximumMinimumTemperatureRemark, IHourlyMaximumTemperatureRemark, IHourlyMinimumTemperatureRemark, IHourlyPrecipitationAmountRemark, IHourlyPressureRemark, IHourlyTemperatureDewPointRemark, IIceAccretionRemark, IMetar, IMetarTAFParserOptions, IMetarTAFParserOptionsDated, IMetarTrend, IMetarTrendTime, IObscurationRemark, IPrecipitationAmount24HourRemark, IPrecipitationAmount36HourRemark, IPrecipitationBegEndRemark, IPrevailingVisibilityRemark, IRunwayInfo, ISeaLevelPressureRemark, ISecondLocationVisibilityRemark, ISectorVisibilityRemark, ISmallHailSizeRemark, ISnowIncreaseRemark, ISnowPelletsRemark, ISunshineDurationRemark, ISurfaceVisibilityRemark, ITAF, ITAFDated, ITemperature, ITemperatureDated, IThunderStormLocationMovingRemark, IThunderStormLocationRemark, ITime, ITornadicActivityBegEndRemark, ITornadicActivityBegRemark, ITornadicActivityEndRemark, ITowerVisibilityRemark, IUnknownRemark, IValidity, IValidityDated, IVariableSkyHeightRemark, IVariableSkyRemark, IVirgaDirectionRemark, IWaterEquivalentSnowRemark, IWeatherCondition, IWind, IWindPeakCommandRemark, IWindShear, IWindShiftFropaRemark, Intensity, InvalidWeatherStatementError, Locale, ParseError, Phenomenon, Remark, RemarkType, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TAFTrend, TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, UnexpectedParseError, ValueIndicator, Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
@@ -436,6 +436,12 @@ var DistanceUnit;
436
436
  DistanceUnit["Meters"] = "m";
437
437
  DistanceUnit["StatuteMiles"] = "SM";
438
438
  })(DistanceUnit || (DistanceUnit = {}));
439
+ var SpeedUnit;
440
+ (function (SpeedUnit) {
441
+ SpeedUnit["Knot"] = "KT";
442
+ SpeedUnit["MetersPerSecond"] = "MPS";
443
+ SpeedUnit["KilometersPerHour"] = "KM/H";
444
+ })(SpeedUnit || (SpeedUnit = {}));
439
445
  /**
440
446
  * Used to indicate the actual value is greater than or less than the value written
441
447
  *
@@ -1743,7 +1749,7 @@ function makeWind(direction, speed, gust, unit) {
1743
1749
  direction: degreesToCardinal(direction),
1744
1750
  degrees: direction !== "VRB" ? +direction : undefined,
1745
1751
  gust: gust ? +gust : undefined,
1746
- unit: unit || "KT",
1752
+ unit,
1747
1753
  };
1748
1754
  }
1749
1755
  class CloudCommand {
@@ -1806,7 +1812,7 @@ class WindCommand {
1806
1812
  const matches = windString.match(__classPrivateFieldGet(this, _WindCommand_regex, "f"));
1807
1813
  if (!matches)
1808
1814
  throw new UnexpectedParseError("Wind should be defined");
1809
- return makeWind(matches[1], matches[2], matches[3], matches[4]);
1815
+ return makeWind(matches[1], matches[2], matches[3], as(matches[4] || "KT", SpeedUnit));
1810
1816
  }
1811
1817
  execute(container, windString) {
1812
1818
  const wind = this.parseWind(windString);
@@ -1849,7 +1855,7 @@ class WindShearCommand {
1849
1855
  if (!matches)
1850
1856
  throw new UnexpectedParseError("Wind shear should be defined");
1851
1857
  return {
1852
- ...makeWind(matches[2], matches[3], matches[4], matches[5]),
1858
+ ...makeWind(matches[2], matches[3], matches[4], as(matches[5], SpeedUnit)),
1853
1859
  height: 100 * +matches[1],
1854
1860
  };
1855
1861
  }
@@ -2818,4 +2824,4 @@ function parse(rawReport, options, parser, datesHydrator) {
2818
2824
  }
2819
2825
  }
2820
2826
 
2821
- export { CloudQuantity, CloudType, CommandExecutionError, Descriptive, Direction, DistanceUnit, Intensity, InvalidWeatherStatementError, ParseError, Phenomenon, RemarkType, RunwayInfoTrend, RunwayInfoUnit, TimeIndicator, TimestampOutOfBoundsError, UnexpectedParseError, ValueIndicator, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
2827
+ export { CloudQuantity, CloudType, CommandExecutionError, Descriptive, Direction, DistanceUnit, Intensity, InvalidWeatherStatementError, ParseError, Phenomenon, RemarkType, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TimeIndicator, TimestampOutOfBoundsError, UnexpectedParseError, ValueIndicator, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metar-taf-parser",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Parse METAR and TAF reports",
5
5
  "homepage": "https://aeharding.github.io/metar-taf-parser",
6
6
  "keywords": [