projeto-hit/backend/src/helpers/ValidatePhoneName.ts

19 lines
496 B
TypeScript

import getNumberFromName from "./GetNumberSequence";
import phoneNumberStart from "./PhoneNumberStatusCode";
function validatePhoneName(name: string) {
if (getNumberFromName(name).length > 0 && getNumberFromName(name).length <= 6) {
return 'invalid_phone_number';
}
else if (getNumberFromName(name).length == 0) {
return 'no_phone_number';
}
else if (!phoneNumberStart(name)) {
return 'wrong_number_start'
}
}
export default validatePhoneName