🚚 Move Slug/Hash Generators to own file

This commit is contained in:
Dan Jones 2025-03-14 19:50:24 -05:00
commit 1d0f2238b3
7 changed files with 193 additions and 162 deletions

View file

@ -18,49 +18,3 @@ func ExampleWithGenerator_custom_generator() {
// hello.txt
// hello
}
func ExampleSlug() {
conf := NewConfig(WithGenerator(Slug()), WithOriginal("My name is Jimmy"))
str, _ := Make(conf)
fmt.Println(str)
// Output: my-name-is-jimmy.txt
}
func ExampleSlugWithLang() {
conf := NewConfig(WithGenerator(SlugWithLang("de")), WithOriginal("Diese & Dass"))
str, _ := Make(conf)
fmt.Println(str)
// Output: diese-und-dass.txt
}
func ExampleHash_mD5() {
conf := NewConfig(
WithOriginal("foobar"),
WithGenerator(Hash(MD5)),
)
str, _ := Make(conf)
fmt.Println(str)
// Output: 3858f62230ac3c915f300c664312c63f.txt
}
func ExampleHash_sHA1() {
conf := NewConfig(
WithOriginal("foobar"),
WithGenerator(Hash(SHA1)),
)
str, _ := Make(conf)
fmt.Println(str)
// Output: 8843d7f92416211de9ebb963ff4ce28125932878.txt
}
func ExampleHash_sHA256() {
conf := NewConfig(
WithOriginal("foobar"),
WithGenerator(Hash(SHA256)),
)
str, _ := Make(conf)
fmt.Println(str)
// Output: c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2.txt
}