{"modulePath":"github.com/Defacto2/server","version":"v1.16.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package areacode\n\nPackage areacode provides information about North American Numbering Plan telephone area codes.\n\n## Functions\n\n```go\nfunc All() map[NAN]string\n```\nAll returns a read-only map of the North American Numbering Plan area codes that provide additional information, such as when an area code was split or created and the regions it serves. Callers must not modify the returned map.\n\n```go\nfunc Contains(target Region, regions []Region) bool\n```\nContains returns true if the region is in the list of regions.\n\n## Types\n\n```go\ntype Abbreviation string\n```\nAbbreviation represents a two-letter abbreviation for a region in the North American Numbering Plan.\n\n```go\nfunc Abbreviations() []Abbreviation\n```\nAbbreviations returns a list of all two-letter abbreviations for regions in the North American Numbering Plan sorted in ascending order.\n\n```go\nfunc (a Abbreviation) HTML() template.HTML\n```\n\n```go\ntype NAN int\n```\nNAN represents a North American Numbering Plan area code.\n\n```go\nfunc AreaCodes() []NAN\n```\nAreaCodes returns a list of all NANP area codes sorted in ascending order.\n\n```go\nfunc (c NAN) HTML() template.HTML\n```\nHTML returns the NANP code as an HTML span element.\n\nExample:\n\n\t212 - New York (NY)\n\n```go\nfunc (c NAN) Valid() bool\n```\nValid returns true if the NANP code is a valid area code.\n\n```go\ntype Region struct {\n\tName         string       // Name of the state, province, or territory.\n\tAbbreviation Abbreviation // Two-letter abbreviation.\n\tAreaCodes    []NAN        // Three-digit NAN code used for telephone area codes.\n}\n```\nRegion represents a region in the North American Numbering Plan.\n\n```go\nfunc CanadaProvinces() [13]Region\n```\nCanadaProvinces is a list of Canadian provinces in the North American Numbering Plan. These can be checked against official lists to ensure accuracy.\n\n```go\nfunc Lookup(a any) []Region\n```\nLookup returns a list of regions that match the given input. The input can be a string, integer, or NAN. If the input is a string, it will match against region names and abbreviations. If the input is an integer, it will match against NANP codes.\n\n```go\nfunc Lookups(a ...any) []Region\n```\nLookups returns a list of regions that match the given inputs.\n\nSee Lookup for more information.\n\n```go\nfunc Miscellaneous() [2]Region\n```\nMiscellaneous regions in the North American Numbering Plan. These can be checked against official lists to ensure accuracy.\n\n```go\nfunc RegionByAbbr(abbr Abbreviation) (Region, bool)\n```\nRegionByAbbr returns the region with the given two-letter abbreviation.\n\n```go\nfunc RegionByCode(code NAN) []Region\n```\nRegionByCode returns the regions for the given North American Numbering code.\n\nGenerally, this will return a single region, but it is possible for a NAN code to be used in multiple regions, such as provinces in Canada.\n\n```go\nfunc RegionByName(name string) Region\n```\nRegionByName returns the region with the given name. The name can be a US state, Canadian province, or other territory.\n\n```go\nfunc RegionContains(s string) []Region\n```\nRegionContains returns a list of regions with names that contain the given string.\n\n```go\nfunc Regions() []Region\n```\nRegions returns a list of all regions in the North American Numbering Plan sorted by name in ascending order.\n\n```go\nfunc USAStates() [51]Region\n```\nUSAStates is a list of states of the USA in the North American Numbering Plan. These can be checked against official lists to ensure accuracy.\n\n```go\nfunc (t Region) HTML() template.HTML\n```\n\n```go\ntype Result struct {\n\tRegion   []Region\n\tAreaCode NAN\n}\n```\nResult represents the result of a query, which can be an area code or a list of regions.\n\n```go\nfunc Queries(s ...string) []Result\n```\nQueries returns a list of results for multiple queries from a form input.\n\n```go\nfunc Query(a any) Result\n```\nQuery returns the result of a query from a form input.\n\n","path":"github.com/Defacto2/server/handler/areacode","name":"areacode","synopsis":"Package areacode provides information about North American Numbering Plan telephone area codes.","isRedistributable":true}
