Skip to content

Commit 8956535

Browse files
committed
feat: use enum
1 parent bda5869 commit 8956535

File tree

4 files changed

+26
-39
lines changed

4 files changed

+26
-39
lines changed

.github/workflows/dependabot-merge.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@recodive/seasonal-branding",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"main": "bin/index.js",
55
"types": "bin/index.d.ts",
66
"repository": "https://github.com/Recodive/Seasonal-Branding.git",
@@ -23,7 +23,7 @@
2323
"typescript": "^4.7.4"
2424
},
2525
"dependencies": {
26-
"date-chinese": "^2.1.4",
26+
"date-chinese": "2.1.3",
2727
"source-map-support": "^0.5.21"
2828
}
2929
}

src/index.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,24 @@ import isLunarNewYear from "./functions/isLunarNewYear";
66
import isNewYear from "./functions/isNewYear";
77
import isValentine from "./functions/isValentine";
88

9-
export type SeasonalEvents =
10-
| "New Year's Day"
11-
| "Lunar New Year"
12-
| "Valentine's Day"
13-
| "Easter"
14-
| "April Fools"
15-
| "Halloween"
16-
| "Christmas"
17-
| "None";
9+
export enum SeasonalEvents {
10+
NewYear = "New Year's Day",
11+
LunarNewYear = "Lunar New Year",
12+
Valentine = "Valentine's Day",
13+
Easter = "Easter",
14+
AprilFools = "April Fools",
15+
Halloween = "Halloween",
16+
Christmas = "Christmas",
17+
None = "None"
18+
}
1819

1920
export function getSeasonalBranding(): SeasonalEvents {
20-
if (isNewYear()) return "New Year's Day";
21-
if (isLunarNewYear()) return "Lunar New Year";
22-
if (isValentine()) return "Valentine's Day";
23-
if (isEaster()) return "Easter";
24-
if (isAprilFools()) return "April Fools";
25-
if (isHalloween()) return "Halloween";
26-
if (isChristmas()) return "Christmas";
27-
return "None";
21+
if (isNewYear()) return SeasonalEvents.NewYear;
22+
if (isLunarNewYear()) return SeasonalEvents.LunarNewYear;
23+
if (isValentine()) return SeasonalEvents.Valentine;
24+
if (isEaster()) return SeasonalEvents.Easter;
25+
if (isAprilFools()) return SeasonalEvents.AprilFools;
26+
if (isHalloween()) return SeasonalEvents.Halloween;
27+
if (isChristmas()) return SeasonalEvents.Christmas;
28+
return SeasonalEvents.None;
2829
}

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ argparse@^1.0.7:
843843
dependencies:
844844
sprintf-js "~1.0.2"
845845

846-
astronomia@^4.1.0:
846+
astronomia@^4.0.1:
847847
version "4.1.1"
848848
resolved "https://registry.yarnpkg.com/astronomia/-/astronomia-4.1.1.tgz#9ad4d3cd1dc8135b7c9e5cee37cb77160ee7af7f"
849849
integrity sha512-TcJD9lUC5eAo0/Ji7rnQauX/yQbi0yZWM+JsNr77W3OA5fsrgvuFgubLMFwfw4VlZ29cu9dG/yfJbfvuTSftjg==
@@ -1118,12 +1118,12 @@ data-urls@^2.0.0:
11181118
whatwg-mimetype "^2.3.0"
11191119
whatwg-url "^8.0.0"
11201120

1121-
date-chinese@^2.1.4:
1122-
version "2.1.4"
1123-
resolved "https://registry.yarnpkg.com/date-chinese/-/date-chinese-2.1.4.tgz#f471af3b72525b6005a16ec4e544a53b28c8e656"
1124-
integrity sha512-WY+6+Qw92ZGWFvGtStmNQHEYpNa87b8IAQ5T8VKt4wqrn24lBXyyBnWI5jAIyy7h/KVwJZ06bD8l/b7yss82Ww==
1121+
date-chinese@2.1.3:
1122+
version "2.1.3"
1123+
resolved "https://registry.yarnpkg.com/date-chinese/-/date-chinese-2.1.3.tgz#60d1ffb3631c3980f420873c4888b3380bc65d84"
1124+
integrity sha512-g1YSDAY01sBLu5NfjpnhXGZu9xoC1xtEKHlCHQNYUIivz85Iea7WBzGPKUIBPfyejZ6x2YA64HSbTYjmzq2Yew==
11251125
dependencies:
1126-
astronomia "^4.1.0"
1126+
astronomia "^4.0.1"
11271127

11281128
debug@4, debug@^4.1.0, debug@^4.1.1:
11291129
version "4.3.3"

0 commit comments

Comments
 (0)