Skip to content

Commit c414d2c

Browse files
committed
cleanup
1 parent 993aedf commit c414d2c

File tree

3 files changed

+33
-19
lines changed

3 files changed

+33
-19
lines changed

packages/shared/src/country-codes.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,18 @@ export const COUNTRY_NAME_TO_CODE: Record<string, string> = {
268268
* @returns The ISO country code, or the original name if not found
269269
*/
270270
export function getCountryCode(countryName: string): string {
271-
if (!countryName) return '';
271+
if (!countryName) {
272+
return '';
273+
}
272274

273-
if (countryName === 'IL') return 'PS';
275+
if (countryName === 'IL') {
276+
return 'PS';
277+
}
274278

275279
const exactMatch = COUNTRY_NAME_TO_CODE[countryName];
276-
if (exactMatch) return exactMatch;
280+
if (exactMatch) {
281+
return exactMatch;
282+
}
277283

278284
const normalizedName = countryName.toLowerCase();
279285
for (const [name, code] of Object.entries(COUNTRY_NAME_TO_CODE)) {
@@ -291,9 +297,13 @@ export function getCountryCode(countryName: string): string {
291297
* @returns The country name, or the original code if not found
292298
*/
293299
export function getCountryName(countryCode: string): string {
294-
if (!countryCode) return '';
300+
if (!countryCode) {
301+
return '';
302+
}
295303

296-
if (countryCode === 'PS') return 'Palestine';
304+
if (countryCode === 'PS') {
305+
return 'Palestine';
306+
}
297307

298308
for (const [name, code] of Object.entries(COUNTRY_NAME_TO_CODE)) {
299309
if (code === countryCode) {

packages/shared/src/utils/date-utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export function formatDate(
3333
date: DateInput,
3434
options?: DateFormatOptions
3535
): string {
36-
if (!date) return '';
36+
if (!date) {
37+
return '';
38+
}
3739

3840
const timezone = options?.timezone || 'UTC';
3941
const dayjsDate = dayjs(date).tz(timezone);
@@ -85,6 +87,8 @@ export function findTimezoneByRegion(region: string) {
8587
* @returns Relative time string
8688
*/
8789
export function formatRelativeTime(date: DateInput): string {
88-
if (!date) return '';
90+
if (!date) {
91+
return '';
92+
}
8993
return dayjs(date).fromNow();
9094
}

packages/shared/src/utils/discord-webhook.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class DiscordWebhook {
8686
/**
8787
* Send a simple text message
8888
*/
89-
async sendMessage(
89+
sendMessage(
9090
content: string,
9191
options: Partial<DiscordWebhookMessage> = {}
9292
): Promise<boolean> {
@@ -101,7 +101,7 @@ class DiscordWebhook {
101101
/**
102102
* Send a message with embed
103103
*/
104-
async sendEmbed(
104+
sendEmbed(
105105
embed: DiscordEmbed,
106106
options: Partial<DiscordWebhookMessage> = {}
107107
): Promise<boolean> {
@@ -116,7 +116,7 @@ class DiscordWebhook {
116116
/**
117117
* Send a log message with proper formatting
118118
*/
119-
async sendLog(logMessage: LogMessage): Promise<boolean> {
119+
sendLog(logMessage: LogMessage): Promise<boolean> {
120120
const {
121121
level,
122122
title,
@@ -171,39 +171,39 @@ class DiscordWebhook {
171171
/**
172172
* Quick log methods for different levels
173173
*/
174-
async logInfo(
174+
logInfo(
175175
title: string,
176176
message: string,
177177
metadata?: Record<string, unknown>
178178
): Promise<boolean> {
179179
return this.sendLog({ level: 'info', title, message, metadata });
180180
}
181181

182-
async logSuccess(
182+
logSuccess(
183183
title: string,
184184
message: string,
185185
metadata?: Record<string, unknown>
186186
): Promise<boolean> {
187187
return this.sendLog({ level: 'success', title, message, metadata });
188188
}
189189

190-
async logWarning(
190+
logWarning(
191191
title: string,
192192
message: string,
193193
metadata?: Record<string, unknown>
194194
): Promise<boolean> {
195195
return this.sendLog({ level: 'warning', title, message, metadata });
196196
}
197197

198-
async logError(
198+
logError(
199199
title: string,
200200
message: string,
201201
metadata?: Record<string, unknown>
202202
): Promise<boolean> {
203203
return this.sendLog({ level: 'error', title, message, metadata });
204204
}
205205

206-
async logDebug(
206+
logDebug(
207207
title: string,
208208
message: string,
209209
metadata?: Record<string, unknown>
@@ -214,7 +214,7 @@ class DiscordWebhook {
214214
/**
215215
* Send user activity log
216216
*/
217-
async logUserActivity(
217+
logUserActivity(
218218
action: string,
219219
userId: string,
220220
details?: Record<string, unknown>
@@ -231,7 +231,7 @@ class DiscordWebhook {
231231
/**
232232
* Send error with stack trace
233233
*/
234-
async logException(
234+
logException(
235235
error: Error,
236236
context?: Record<string, unknown>
237237
): Promise<boolean> {
@@ -252,7 +252,7 @@ class DiscordWebhook {
252252
/**
253253
* Send system notification
254254
*/
255-
async sendSystemNotification(
255+
sendSystemNotification(
256256
title: string,
257257
message: string,
258258
level: LogLevel = 'info'
@@ -273,7 +273,7 @@ class DiscordWebhook {
273273
/**
274274
* Core send method with rate limiting
275275
*/
276-
private async send(payload: DiscordWebhookMessage): Promise<boolean> {
276+
private send(payload: DiscordWebhookMessage): Promise<boolean> {
277277
return new Promise((resolve) => {
278278
this.rateLimitQueue.push(async () => {
279279
try {

0 commit comments

Comments
 (0)