Skip to content

Commit

Permalink
refactor(forecast): abbr "a few clouds" better
Browse files Browse the repository at this point in the history
  • Loading branch information
Forceh91 committed Nov 16, 2023
1 parent efe8cd0 commit a87f1e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/__tests__/abbreviateForecast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe("Forecast Truncation", () => {
"30% chnc of shwrs/tstorms"
);
expect(abbreviateForecast("rain or flurries overnight", forecastLengthWanted)).toStrictEqual("rain/flrys ovrngt");
expect(abbreviateForecast("a few clouds overnight", forecastLengthWanted)).toStrictEqual("few clouds ovrngt");
});

test("Wintery weather", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/conditions/forecast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const removeJoiningWords = (forecast: string) =>
.replace(/becoming/gi, "bcmg")
.replace(/increasing/gi, "incr")
.replace(/diminishing/gi, "dmnshg")
.replace(/\sa few/gi, "")
.replace(/a few/gi, "few")
.replace(/with/gi, "w/")
.replace(/([a-z])\sor\s/gi, "$1/")
.replace(/and/gi, "&");
Expand Down

0 comments on commit a87f1e4

Please sign in to comment.