phone

package
v0.0.0-...-81dc835 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAlpha2 []string
View Source
var AllCountries []Country
View Source
var ErrNotInE164Format = errors.New("not in E.164 format")

ErrNotInE164Format means the given phone number is not in E.164 format.

View Source
var ErrPhoneNumberInvalid = errors.New("invalid phone number")

ErrPhoneNumberInvalid means phone number doesn't pass validation

View Source
var JSONSchemaString string

Functions

func Mask

func Mask(phone string) string

Mask masks the give phone number.

func MaskWithCustomRune

func MaskWithCustomRune(phone string, r rune) string

MaskWithCustomRune masks the give phone number with specific rune.

func Parse_IsPossibleNumber_ReturnE164

func Parse_IsPossibleNumber_ReturnE164(userInput string) (e164 string, err error)

func Require_IsPossibleNumber_IsValidNumber_UserInputInE164

func Require_IsPossibleNumber_IsValidNumber_UserInputInE164(userInput string) error

Types

type Country

type Country struct {
	Alpha2             string
	CountryCallingCode string
}

type ParsedPhoneNumber

type ParsedPhoneNumber struct {
	UserInput                         string
	E164                              string
	Alpha2                            string
	IsPossibleNumber                  bool
	IsValidNumber                     bool
	CountryCallingCodeWithoutPlusSign string
	NationalNumberWithoutFormatting   string
}

func ParsePhoneNumberWithUserInput

func ParsePhoneNumberWithUserInput(userInput string) (*ParsedPhoneNumber, error)

func (ParsedPhoneNumber) IsNorthAmericaNumber

func (n ParsedPhoneNumber) IsNorthAmericaNumber() bool

func (ParsedPhoneNumber) RequireIsPossibleNumber

func (n ParsedPhoneNumber) RequireIsPossibleNumber() error

func (ParsedPhoneNumber) RequireIsValidNumber

func (n ParsedPhoneNumber) RequireIsValidNumber() error

func (ParsedPhoneNumber) RequireUserInputInE164

func (n ParsedPhoneNumber) RequireUserInputInE164() error

func (ParsedPhoneNumber) Require_IsPossibleNumber_IsValidNumber_UserInputInE164

func (n ParsedPhoneNumber) Require_IsPossibleNumber_IsValidNumber_UserInputInE164() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL