Skip to content

Commit

Permalink
feat: user helper class
Browse files Browse the repository at this point in the history
  • Loading branch information
aniebietafia committed Sep 2, 2024
1 parent e087559 commit 80e0855
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions brints-estate-api/src/utils/userHelper.lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export class UserHelper {
constructor() {}

public capitalizeFirstLetter(name: string): string {
return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
}

public validateCountryCode(countryCode: string): boolean {
return countryCode.startsWith('+');
}

public formatPhoneNumber(countryCode: string, phoneNumber: string): string {
if (phoneNumber.startsWith('0')) {
phoneNumber = phoneNumber.slice(1);
}
return `${countryCode}${phoneNumber}`;
}
}

0 comments on commit 80e0855

Please sign in to comment.