⚙️ Golang utility library with syntactic sugar. It's like lodash, but for golang.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
array.go
array_test.go
collection.go
collection_test.go
date.go
date_test.go
is.go
is_test.go
lib.go
number.go
performance_test.go
string.go
string_test.go

README.md

GUBRAK

Golang utility library with syntactic sugar.

Go Report Card Build Status cover.run

Gubrak is yet another utility library for Golang, inspired from lodash. Currently we have around 46 reusable functions available, and it'll keep increasing.

Installation

go get -u github.com/novalagung/gubrak

Documentation

See official documentation page.

Godoc documentation page is still in progress.

Hello World Example

package main

import (
  "github.com/novalagung/gubrak"
  "fmt"
)

type Sample struct {
  EbookName      string
  DailyDownloads int
}

func main() {
  data := []Sample{
    { EbookName: "clean code", DailyDownloads: 10000 },
    { EbookName: "rework", DailyDownloads: 12000 },
    { EbookName: "detective comics", DailyDownloads: 11500 },
  }

  result, err := gubrak.Filter(data, func(each Sample) bool {
    return each.DailyDownloads > 11000
  })

  if err != nil {
    fmt.Println("Error!", err.Error)
    return
  }

  fmt.Printf("%#v \n", result.([]Sample))
  /*
  []Sample{
    { EbookName: "rework", DailyDownloads: 12000 },
    { EbookName: "detective comics", DailyDownloads: 11500 },
  }
  */
}

APIs

These are list of available functions that stable.

  • gubrak.Chunk()
  • gubrak.Compact()
  • gubrak.Concat()
  • gubrak.Count()
  • gubrak.Difference()
  • gubrak.Drop()
  • gubrak.DropRight()
  • gubrak.Each()
  • gubrak.EachRight()
  • gubrak.Fill()
  • gubrak.Filter()
  • gubrak.Find()
  • gubrak.FindIndex()
  • gubrak.FindLast()
  • gubrak.FindLastIndex()
  • gubrak.First()
  • gubrak.ForEach()
  • gubrak.ForEachRight()
  • gubrak.FromPairs()
  • gubrak.GroupBy()
  • gubrak.Head()
  • gubrak.Includes()
  • gubrak.IndexOf()
  • gubrak.Initial()
  • gubrak.Intersection()
  • gubrak.IsArray()
  • gubrak.IsBool()
  • gubrak.IsChannel()
  • gubrak.IsDate()
  • gubrak.IsEmpty()
  • gubrak.IsEmptyString()
  • gubrak.IsFloat()
  • gubrak.IsFunction()
  • gubrak.IsInt()
  • gubrak.IsMap()
  • gubrak.IsNil()
  • gubrak.IsNumeric()
  • gubrak.IsPointer()
  • gubrak.IsSlice()
  • gubrak.IsString()
  • gubrak.IsStructObject()
  • gubrak.IsTrue()
  • gubrak.IsUint()
  • gubrak.IsZeroNumber()
  • gubrak.Join()
  • gubrak.KeyBy()
  • gubrak.Last()
  • gubrak.LastIndexOf()
  • gubrak.Map()
  • gubrak.Now()
  • gubrak.Nth()
  • gubrak.OrderBy()
  • gubrak.Partition()
  • gubrak.Pull()
  • gubrak.PullAll()
  • gubrak.PullAt()
  • gubrak.RandomInt()
  • gubrak.RandomString()
  • gubrak.RandomStringAlphabet()
  • gubrak.Reduce()
  • gubrak.Reject()
  • gubrak.Remove()
  • gubrak.Reverse()
  • gubrak.Sample()
  • gubrak.SampleSize()
  • gubrak.Shuffle()
  • gubrak.Size()
  • gubrak.SortBy()
  • gubrak.Tail()
  • gubrak.Take()
  • gubrak.TakeRight()
  • gubrak.Union()
  • gubrak.Uniq()
  • gubrak.Without()
  • gubrak.Xor()

Contribution

Fork ➜ Create branch ➜ Commit ➜ Push ➜ Pull Requests

License

MIT License