Skip to content

🦄 A list of utility functions to make your Go development easier. Inspired by Lodash, written in Go.

License

Notifications You must be signed in to change notification settings

alperencantez/unicornia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦄 Unicornia

A list of utility functions to make your Go development easier. Inspired by Lodash, written in Go.

This is the version 1.0 & feel free to contribute.

Nice to know

  • Godoc is available for all the methods. You can get the detailed information about a specific function just by hovering on it.
  • While creating Unicornia, I tried to avoid extra 3rd party packages because I wanted to keep it simple and steady.

Strings

uuid := unicornia.StringUuid() // FD98536E-63B6-404F-A1CD-45BDBE9E2864
toSnakeCase := unicornia.StringToSnakeCase("unicornia is great") // unicornia_is_great
truncate := unicornia.StringTruncate("never gonna give you up", 8) // never go...
repeat := unicornia.StringRepeat("go", 4) // gogogogo
startsWith := unicornia.StringStartsWith("unicornia", "un") // true
endsWith := unicornia.StringEndsWith("unicornia", "xo") // false
isAlphaNum := unicornia.StringIsAlphaNum("42") // true
slug := unicornia.StringSlugify("unicornia is a utility library FOR Go")
// unicornia-is-a-utility-library-for-go

Arrays

shuffled := unicornia.ArrayShuffle([]any{1, 2, 3, "unicornia is great"})
// [3 1 unicornia is great 2]
includes := unicornia.ArrayIncludes([]int{1, 2, 3}, 5) // false
findIndex := unicornia.ArrayFindIndex([]int{1, 2, 3}, 2) // 1
reversedArray := unicornia.ArrayReverse([]int{1, 2, 3, 4, 5}) // [5 4 3 2 1]
sortedArray := unicornia.ArrayIntSort([]int{1, 2, 3, 4}, "desc") // [4 3 2 1]
intersection := unicornia.ArrayIntersection([]int{1, 2, 3, 4}, []int{1, 6, 3,7}) // [1 3]

Math

inRange := unicornia.MathInRange(42, 1, 83) // true
mean := unicornia.MathFindMean(30, 40, 56) // 42

Utils

isCreditCard := unicornia.UtilsIsCreditCard("4225319580287") // true visa

LICENSE

This project is licensed under the MIT License.

initial commit on 2023-10-28

About

🦄 A list of utility functions to make your Go development easier. Inspired by Lodash, written in Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages