metar-taf-parser 9.1.1 → 9.1.3

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.
package/README.md CHANGED
@@ -88,7 +88,7 @@ TAF reports are a little funky... FM, BECMG, PROB, weird validity periods, etc.
88
88
 
89
89
  #### `parseTAFAsForecast`
90
90
 
91
- Returns a more normalized TAF report than `parseTAF`. Most notably: while the `parseTAF` function returns initial weather conditions on the base of the returned result (and further conditions on `trends[]`), the `parseTAFAsForecast` function returns the initial weather conditions as the first element of the `forecast[]` property (with `type = undefined`), followed by subsequent trends. (For more, please see the above about the forecast abstraction.) This makes it much easier to render a UI similar to the [aviationweather.gov](https://www.aviationweather.gov/taf/data?ids=SBPJ&format=decoded&metars=off&layout=on) TAF decoder.
91
+ Returns a more normalized TAF report than `parseTAF`. Most notably: while the `parseTAF` function returns initial weather conditions on the base of the returned result (and further conditions on `trends[]`), the `parseTAFAsForecast` function returns the initial weather conditions as the first element of the `forecast[]` property (with `type = undefined`), followed by subsequent trends. (For more, please see the above about the forecast abstraction.) This makes it much easier to render a UI similar to the [aviationweather.gov](https://aviationweather.gov/data/taf/?decoded=1&ids=KMSN&metar=0&taf=1) TAF decoder.
92
92
 
93
93
  ```ts
94
94
  import { parseTAFAsForecast } from "metar-taf-parser";
@@ -127,7 +127,7 @@ declare enum TimeIndicator {
127
127
  TL = "TL"
128
128
  }
129
129
  /**
130
- * https://www.aviationweather.gov/taf/decoder
130
+ * https://web.archive.org/web/20230318235549/https://aviationweather.gov/taf/decoder
131
131
  */
132
132
  declare enum WeatherChangeType {
133
133
  /**
@@ -1593,4 +1593,5 @@ declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptions): ITA
1593
1593
  declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptionsDated): ITAFDated;
1594
1594
  declare function parseTAFAsForecast(rawTAF: string, options: IMetarTAFParserOptionsDated): IForecastContainer;
1595
1595
 
1596
- export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, type Distance, DistanceUnit, type Forecast, type IAbstractTrend, type IAbstractValidity, type IAbstractWeatherCode, type IAbstractWeatherCodeDated, type IAbstractWeatherContainer, type IAltimeter, type IBaseRemark, type IBaseRunwayInfo, type IBaseTAFTrend, type ICeilingHeightRemark, type ICeilingSecondLocationRemark, type ICloud, type ICompositeForecast, type IEndValidity, type IFMValidity, type IFlags, type IForecastContainer, type IHourlyMaximumMinimumTemperatureRemark, type IHourlyMaximumTemperatureRemark, type IHourlyMinimumTemperatureRemark, type IHourlyPrecipitationAmountRemark, type IHourlyPressureRemark, type IHourlyTemperatureDewPointRemark, type IIceAccretionRemark, type IIcing, type IMetar, type IMetarDated, type IMetarTAFParserOptions, type IMetarTAFParserOptionsDated, type IMetarTrend, type IMetarTrendTime, type INextForecastByRemark, type INextForecastByRemarkDated, type IObscurationRemark, type IPrecipitationAmount24HourRemark, type IPrecipitationAmount36HourRemark, type IPrecipitationBegEndRemark, type IPrevailingVisibilityRemark, type IRunwayInfoDeposit, type IRunwayInfoRange, type ISeaLevelPressureRemark, type ISecondLocationVisibilityRemark, type ISectorVisibilityRemark, type ISmallHailSizeRemark, type ISnowIncreaseRemark, type ISnowPelletsRemark, type ISunshineDurationRemark, type ISurfaceVisibilityRemark, type ITAF, type ITAFDated, type ITafGroups, type ITemperature, type ITemperatureDated, type IThunderStormLocationMovingRemark, type IThunderStormLocationRemark, type ITime, type ITornadicActivityBegEndRemark, type ITornadicActivityBegRemark, type ITornadicActivityEndRemark, type ITowerVisibilityRemark, type ITurbulence, type IUnknownRemark, type IValidity, type IValidityDated, type IVariableSkyHeightRemark, type IVariableSkyRemark, type IVirgaDirectionRemark, type IWaterEquivalentSnowRemark, type IWeatherCondition, type IWind, type IWindPeakCommandRemark, type IWindShear, type IWindShiftFropaRemark, IcingIntensity, Intensity, InvalidWeatherStatementError, type Locale, MetarType, ParseError, PartialWeatherStatementError, Phenomenon, type Remark, type RemarkDated, RemarkType, type RunwayInfo, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, type TAFTrend, type TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, type Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
1596
+ export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, DistanceUnit, IcingIntensity, Intensity, InvalidWeatherStatementError, MetarType, ParseError, PartialWeatherStatementError, Phenomenon, RemarkType, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
1597
+ export type { Distance, Forecast, IAbstractTrend, IAbstractValidity, IAbstractWeatherCode, IAbstractWeatherCodeDated, IAbstractWeatherContainer, IAltimeter, IBaseRemark, IBaseRunwayInfo, IBaseTAFTrend, ICeilingHeightRemark, ICeilingSecondLocationRemark, ICloud, ICompositeForecast, IEndValidity, IFMValidity, IFlags, IForecastContainer, IHourlyMaximumMinimumTemperatureRemark, IHourlyMaximumTemperatureRemark, IHourlyMinimumTemperatureRemark, IHourlyPrecipitationAmountRemark, IHourlyPressureRemark, IHourlyTemperatureDewPointRemark, IIceAccretionRemark, IIcing, IMetar, IMetarDated, IMetarTAFParserOptions, IMetarTAFParserOptionsDated, IMetarTrend, IMetarTrendTime, INextForecastByRemark, INextForecastByRemarkDated, IObscurationRemark, IPrecipitationAmount24HourRemark, IPrecipitationAmount36HourRemark, IPrecipitationBegEndRemark, IPrevailingVisibilityRemark, IRunwayInfoDeposit, IRunwayInfoRange, ISeaLevelPressureRemark, ISecondLocationVisibilityRemark, ISectorVisibilityRemark, ISmallHailSizeRemark, ISnowIncreaseRemark, ISnowPelletsRemark, ISunshineDurationRemark, ISurfaceVisibilityRemark, ITAF, ITAFDated, ITafGroups, ITemperature, ITemperatureDated, IThunderStormLocationMovingRemark, IThunderStormLocationRemark, ITime, ITornadicActivityBegEndRemark, ITornadicActivityBegRemark, ITornadicActivityEndRemark, ITowerVisibilityRemark, ITurbulence, IUnknownRemark, IValidity, IValidityDated, IVariableSkyHeightRemark, IVariableSkyRemark, IVirgaDirectionRemark, IWaterEquivalentSnowRemark, IWeatherCondition, IWind, IWindPeakCommandRemark, IWindShear, IWindShiftFropaRemark, Locale, Remark, RemarkDated, RunwayInfo, TAFTrend, TAFTrendDated, Visibility };
@@ -346,7 +346,7 @@ var TimeIndicator;
346
346
  TimeIndicator["TL"] = "TL";
347
347
  })(TimeIndicator || (TimeIndicator = {}));
348
348
  /**
349
- * https://www.aviationweather.gov/taf/decoder
349
+ * https://web.archive.org/web/20230318235549/https://aviationweather.gov/taf/decoder
350
350
  */
351
351
  var WeatherChangeType;
352
352
  (function (WeatherChangeType) {
@@ -2150,7 +2150,7 @@ var _RunwayCommand_genericRegex, _RunwayCommand_runwayMaxRangeRegex, _RunwayComm
2150
2150
  class RunwayCommand {
2151
2151
  constructor() {
2152
2152
  _RunwayCommand_genericRegex.set(this, /^(R\d{2}\w?\/)/);
2153
- _RunwayCommand_runwayMaxRangeRegex.set(this, /^R(\d{2}\w?)\/(\d{4})V(\d{3,4})(?:([UDN])|(FT)(?:\/([UDN]))?)$/);
2153
+ _RunwayCommand_runwayMaxRangeRegex.set(this, /^R(\d{2}\w?)\/(\d{4})V([MP])?(\d{3,4})(?:([UDN])|(FT)(?:\/([UDN]))?)$/);
2154
2154
  _RunwayCommand_runwayRegex.set(this, /^R(\d{2}\w?)\/([MP])?(\d{4})(?:([UDN])|(FT)(?:\/([UDN]))?)$/);
2155
2155
  _RunwayCommand_runwayDepositRegex.set(this, /^R(\d{2}\w?)\/([/\d])([/\d])(\/\/|\d{2})(\/\/|\d{2})$/);
2156
2156
  }
@@ -2198,19 +2198,21 @@ class RunwayCommand {
2198
2198
  const matches = input.match(__classPrivateFieldGet(this, _RunwayCommand_runwayMaxRangeRegex, "f"));
2199
2199
  if (!matches)
2200
2200
  throw new UnexpectedParseError("Should be able to parse");
2201
+ const indicator = matches[3] ? as(matches[3], ValueIndicator) : undefined;
2201
2202
  const trend = (() => {
2202
- if (matches[6])
2203
- return as(matches[6], RunwayInfoTrend);
2204
- if (matches[4])
2205
- return as(matches[4], RunwayInfoTrend);
2203
+ if (matches[7])
2204
+ return as(matches[7], RunwayInfoTrend);
2205
+ if (matches[5])
2206
+ return as(matches[5], RunwayInfoTrend);
2206
2207
  })();
2207
- const unit = matches[5]
2208
- ? as(matches[5], RunwayInfoUnit)
2208
+ const unit = matches[6]
2209
+ ? as(matches[6], RunwayInfoUnit)
2209
2210
  : RunwayInfoUnit.Meters;
2210
2211
  metar.runwaysInfo.push({
2211
2212
  name: matches[1],
2213
+ indicator,
2212
2214
  minRange: +matches[2],
2213
- maxRange: +matches[3],
2215
+ maxRange: +matches[4],
2214
2216
  trend,
2215
2217
  unit,
2216
2218
  });
@@ -2533,7 +2535,8 @@ class MetarParser extends AbstractParser {
2533
2535
  while (i < trendParts.length &&
2534
2536
  trendParts[i] !== this.TEMPO &&
2535
2537
  trendParts[i] !== this.INTER &&
2536
- trendParts[i] !== this.BECMG) {
2538
+ trendParts[i] !== this.BECMG &&
2539
+ trendParts[i] !== this.RMK) {
2537
2540
  if (trendParts[i].startsWith(this.FM) ||
2538
2541
  trendParts[i].startsWith(this.TL) ||
2539
2542
  trendParts[i].startsWith(this.AT)) {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "metar-taf-parser",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
4
4
  "description": "Parse METAR and TAF reports",
5
5
  "homepage": "https://aeharding.github.io/metar-taf-parser",
6
- "packageManager": "pnpm@9.0.6+sha256.0624e30eff866cdeb363b15061bdb7fd9425b17bc1bb42c22f5f4efdea21f6b3",
6
+ "packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be",
7
7
  "keywords": [
8
8
  "aviation",
9
9
  "weather",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "type": "module",
17
17
  "main": "metar-taf-parser.js",
18
- "author": "Alexander Harding <2166114+aeharding@users.noreply.github.com>",
18
+ "author": "Alexander Harding <noreply@harding.dev>",
19
19
  "license": "MIT",
20
20
  "repository": {
21
21
  "type": "git",
@@ -29,8 +29,8 @@
29
29
  "check-types": "tsc --skipLibCheck --noEmit",
30
30
  "check-formatting": "prettier --check '**/*.{js,json,css,md,scss,tsx,ts}'",
31
31
  "watch": "watch 'pnpm build' src",
32
- "test": "jest --coverage",
33
- "test-watch": "jest --watch --coverage",
32
+ "test": "vitest run --coverage",
33
+ "test-watch": "vitest --coverage",
34
34
  "prepublishOnly": "pnpm clean && pnpm build",
35
35
  "upgrade:packageManager": "corepack use pnpm@latest"
36
36
  },
@@ -39,23 +39,19 @@
39
39
  "metar-taf-parser.*"
40
40
  ],
41
41
  "devDependencies": {
42
- "@babel/preset-env": "^7.26.0",
43
- "@babel/preset-typescript": "^7.26.0",
44
- "@rollup/plugin-typescript": "^12.1.2",
45
- "@types/jest": "^29.5.14",
46
- "@types/lodash": "^4.17.14",
47
- "@types/node": "^22.10.5",
48
- "jest": "^29.7.0",
49
- "lodash": "^4.17.21",
50
- "prettier": "^3.4.2",
51
- "rimraf": "^6.0.1",
52
- "rollup": "^4.29.2",
53
- "rollup-plugin-dts": "^6.1.1",
54
- "ts-jest": "^29.2.5",
42
+ "@rollup/plugin-typescript": "^12.3.0",
43
+ "@types/node": "^25.5.0",
44
+ "@vitest/coverage-v8": "^4.1.0",
45
+ "es-toolkit": "^1.45.1",
46
+ "prettier": "^3.8.1",
47
+ "rimraf": "^6.1.3",
48
+ "rollup": "^4.59.0",
49
+ "rollup-plugin-dts": "^6.4.0",
55
50
  "ts-node": "^10.9.2",
56
- "tsc-alias": "^1.8.10",
51
+ "tsc-alias": "^1.8.16",
57
52
  "tslib": "^2.8.1",
58
- "typescript": "^5.7.2",
53
+ "typescript": "^5.9.3",
54
+ "vitest": "^4.1.0",
59
55
  "watch": "^1.0.2"
60
56
  }
61
57
  }