Documentation
¶
Overview ¶
Package lism provides a list of alternative spellings, acronyms and initialisms for the named releasers.
Alternative spellings are the same name but with different casing, spelling or punctuation (e.g. Coca-Cola, Coke).
An acronym is an abbreviation formed from the initial letters of other words and pronounced as a word (e.g. NATO).
An initialism is an abbreviation consisting of the initial letters pronounced individually (e.g. USA).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exist ¶
Exist returns true if the URL path has an initialism.
Example:
Exist("the-firm") = true
Exist("defacto2") = true
Exist("some-random-bbs") = false
Example ¶
package main
import (
"fmt"
"github.com/Defacto2/server/handler/releaser/lism"
)
func main() {
fmt.Println(lism.Exist("defacto2"))
}
Output: true
func Initialism ¶
Initialism returns the alternative spellings, acronyms and initialisms for the URL path. Or an empty slice if the URL path has no initialism.
Example:
Initialism("the-firm") = []string{"FiRM, FRM"}
Initialism("defacto2") = []string{"DF2"}
Example ¶
package main
import (
"fmt"
"github.com/Defacto2/server/handler/releaser/lism"
)
func main() {
fmt.Println(lism.Initialism("defacto2"))
}
Output: [DF2 DF]
func String ¶
String returns the alternative spellings, acronyms and initialisms for the URL path as a comma separated string. Or an empty string if the URL path has no initialism.
Example:
String("the-firm") = "FiRM, FRM"
String("defacto2") = "DF2"
Example ¶
package main
import (
"fmt"
"github.com/Defacto2/server/handler/releaser/lism"
)
func main() {
fmt.Println(lism.String("the-firm")) // FiRM, FRM
fmt.Println(lism.String("united-software-association*fairlight")) // USA
}
Output: FiRM, FRM USA/Fairlight, USA/FLT, USA
Types ¶
type List ¶
List maps the initialisms and acronyms of the releasers.
func Copy ¶
func Copy() List
Copy returns a copy of the [initialisms].
Example ¶
package main
import (
"fmt"
"slices"
"github.com/Defacto2/server/handler/releaser/lism"
)
func main() {
const want = "USA"
for path, names := range lism.Copy() {
if slices.Contains(names, want) {
fmt.Printf("The uri for %v: %v\n", want, path)
}
}
}
Output: The uri for USA: united-software-association*fairlight
type Path ¶
type Path string
Path is the partial URL path of the releaser.
func Find ¶
Find returns the uri Paths that match the given acronym/initialism. Most matches will only return a single path, however, there are situations where two or more releases shared the same initialism.
Example:
Find("Firm") = []Path{"the-firm"}
Example ¶
package main
import (
"fmt"
"github.com/Defacto2/server/handler/releaser/lism"
)
func main() {
fmt.Println(lism.Find("Firm"))
}
Output: [the-firm]