goscore

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2020 License: MIT Imports: 1 Imported by: 0

README

goscore : Underscore like library for golang!

Overview

GoDoc

  • Make Generic lists in golang
  • Write functional code
  • Functions supported
    • Map
    • Reduce
    • Filter
    • Each
    • Reverse
    • Find
    • Delete
    • Unique
    • Sort

Install

go get github.com/Ar11rA/goscore

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List []interface{}

List - Generic List

func (List) DeleteAllInstances

func (l List) DeleteAllInstances(n int) List

DeleteAllInstances - Deletes all elements with the passed value

func (List) DeleteFirstInstance

func (l List) DeleteFirstInstance(n int) List

DeleteFirstInstance - Deletes first instance of element with the passed value

func (List) DeleteIndex

func (l List) DeleteIndex(i int) List

DeleteIndex - Deletes element at particular index

func (List) Each

func (l List) Each(executor func(i interface{}))

Each - Performs action on each element

func (List) Filter

func (l List) Filter(filter func(i interface{}) bool) List

Filter - Returns a filtered list of elements

func (List) Find

func (l List) Find(i interface{}) ([]int, bool)

Find - Finds the passed element and return indices of occurrence and returns true if present

func (List) Map

func (l List) Map(mapper func(i interface{}) interface{}) List

Map - Runs given function for all elements and returns list

func (List) Reduce

func (l List) Reduce(reducer func(acc interface{}, i interface{}) interface{}, acc interface{}) interface{}

Reduce - Accumulates result from given function and returns the result

func (List) Reverse

func (l List) Reverse() List

Reverse - Returns a reversed list

func (List) Sort

func (l List) Sort(sorter func(param1 int, param2 int) bool) List

Sort - Sorts list with given function, sorts in ascending order if no function passed

func (List) Unique

func (l List) Unique() List

Unique - Returns only unique set of elements

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL