MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / sanitizeAddress

Method sanitizeAddress

api/pkg/requests/request.go:24–35  ·  view source on GitHub ↗
(value string)

Source from the content-addressed store, hash-verified

22}
23
24func (input *request) sanitizeAddress(value string) string {
25 value = strings.TrimSpace(value)
26 if !strings.HasPrefix(value, "+") && input.isDigits(value) && len(value) > 9 {
27 value = "+" + value
28 }
29
30 if number, err := phonenumbers.Parse(value, phonenumbers.UNKNOWN_REGION); err == nil {
31 value = phonenumbers.Format(number, phonenumbers.E164)
32 }
33
34 return value
35}
36
37func (input *request) sanitizeContact(owner string, contact string) string {
38 contact = strings.TrimSpace(contact)

Callers 15

sanitizeAddressesMethod · 0.95
SanitizeMethod · 0.45
ToMessageSendParamsMethod · 0.45
SanitizeMethod · 0.45
ToMessageSendParamsMethod · 0.45
SanitizeMethod · 0.45
SanitizeMethod · 0.45
SanitizeMethod · 0.45
SanitizeMethod · 0.45
SanitizeMethod · 0.45
SanitizeMethod · 0.45
ToMessageSendParamsMethod · 0.45

Calls 1

isDigitsMethod · 0.95

Tested by

no test coverage detected