Skip to content

JakeFromSpotLock/extlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Extended Library (extlib)

extlib is a collection of idiomatic Go utilities, containers, and helpers to extend the standard library. It is designed for Go 1.20+ and makes common tasks like math operations, slice manipulation, and stack/queue management easier and type-safe using generics.

Features

  • Containers (containers)
    • Stack (LIFO)
    • Queue (FIFO)
    • Set
  • Math Utilities (mathx)
    • Max, Min, Clamp, Abs
    • Sum, Product
    • Factorial
    • Check if a number is a power of any base (IsPowerOf)
  • Slice Utilities (slicex)
    • Reverse slices
    • Map and Filter functions
    • Contains check
  • String Utilities (stringx)
    • Rune-safe reverse
    • PadLeft/PadRight
    • Case-insensitive equals
  • General Utilities (util)
    • Ternop (ternary operator)
    • Prt (shortcut for printing)

Installation

go get github.com/yourusername/extlib

Usage

package main

import (
    "fmt"

    "github.com/yourusername/extlib/mathx"
    "github.com/yourusername/extlib/slicex"
)

func main() {
    fmt.Println(mathx.Max(10, 20))                  // 20
    fmt.Println(mathx.IsPowerOf(16, 4))             // true
    nums := []int{1, 2, 3, 4}
    slicex.Reverse(nums)
    fmt.Println(nums)                               // [4 3 2 1]
}

Support

If you find this library useful, consider buying me a coffee
It helps keep the project maintained and growing!

About

Go Extended Library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages