Giter Club home page Giter Club logo

gubrak's Introduction

Gubrak v2

Gubrak is Go functional utility library with syntactic sugar. It's like lodash, but for Go Programming language.

Go Report Card Build Status Coverage Status

Installation

The latest version of gubrak is v2. Here are the available method to get this library.

  • Using go get from github, for Go Mod-based project:

    go get -u github.com/novalagung/gubrak/v2
  • Using go get from github, for $GOPATH-based project:

    go get -u github.com/novalagung/gubrak

Usage

Since this library is developed as go module, the versioning system used is the one from Go.

  • For Go Mod-based project:

    import gubrak "github.com/novalagung/gubrak/v2"
  • For $GOPATH-based project:

    import "github.com/novalagung/gubrak"

Documentation

Hello World Example

Lodash for Golang

APIs

Below are the list of available functions on gubrak:

ChunkCompactConcatCountDifferenceDropDropRightEachEachRightFillFilterFindFindIndexFindLastFindLastIndexFirstForEachForEachRightFromPairsGroupByHeadIncludesIndexOfInitialIntersectionIsArrayIsBoolIsChannelIsDateIsEmptyIsEmptyStringIsFloatIsFunctionIsIntIsMapIsNilIsNumericIsPointerIsSliceIsStringIsStructObjectIsTrueIsUintIsZeroNumberJoinKeyByLastLastIndexOfMapNowNthOrderByPartitionPullPullAllPullAtRandomIntRandomStringReduceRejectRemoveReverseSampleSampleSizeShuffleSizeSortByTailTakeTakeRightUnionUniqWithout

Test

go test -cover -race -v ./... 

Contribution

Fork ➜ Create branch ➜ Commit ➜ Push ➜ Pull Requests

License

MIT License

gubrak's People

Contributors

novalagung avatar rohmanhm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gubrak's Issues

same error

Hello , I'm reading you codes these days,but ,unfortunately i saw some errors in you return values.
For example,the func Concat,the right return value is :[1 2 3 4 4 6 7 8 9]
func TakeRight, the right return value is :[5 6 7 8 9]

.OrderBy return panic when collection only contains one data

sample code: https://gist.github.com/wnitya2/f0e7ba5c648b7b5b4019da016f5cc425

when collection only contains 1 data, e.g:

data := []HashMap{
		{ "name": "tim", "hobby": "stay awake all the time" },
}

result, err := gubrak.OrderBy(data, func(each HashMap) string {
		return each["name"]
})

error returns:

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
github.com/novalagung/gubrak.OrderBy.func1.1(0x4df3c0, 0xc042002400, 0x97, 0xc04203c120)
D:/Go/src/github.com/novalagung/gubrak/collection.go:888 +0xd9
github.com/novalagung/gubrak.OrderBy.func1(0x4df3c0, 0xc042002400, 0x4e8780, 0x510aa0, 0x0, 0x0, 0x0, 0xc0420301c0, 0x0, 0x0)
D:/Go/src/github.com/novalagung/gubrak/collection.go:1048 +0x4e6
github.com/novalagung/gubrak.OrderBy(0x4df3c0, 0xc042002400, 0x4e8780, 0x510aa0, 0x0, 0x0, 0x0, 0xc042068060, 0xc04205bf50, 0x4c9db2, ...)
D:/Go/src/github.com/novalagung/gubrak/collection.go:1054 +0x9d
main.main()
D:/Go/src/github.com/wnitya2/gubrak-error-orderby/main.go:15 +0x1cd
exit status 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.