Skip to content

Commit

Permalink
feat(validator): sanitizePhoneNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm authored and AliMD committed Apr 25, 2023
1 parent 994477e commit 41f2050
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/validator/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,9 @@ export function validator<T extends StringifyableRecord>(

return targetObject as T;
}

export function sanitizePhoneNumber(phoneNumber: string): number | null {
phoneNumber = phoneNumber.replace(/ /g, '');
if (isNumber(phoneNumber)) return +phoneNumber;
return null;
}

0 comments on commit 41f2050

Please sign in to comment.