coreutils

package module
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 0 Imported by: 0

README

Core Utils - Generic utils, like lodash

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/core-utils

Getting Started

// see test cases

Spec

Array
func Filter[K any](values []K, fn func(value K, index int) bool) []K
func Find[T comparable](elements []T, compare func(element T, index int) bool) (T, bool)
func FindIndex[T comparable](collection []T, value T) int
func ForEach[K any](values []K, fn func(value K, index int))
func GroupBy[T any, K comparable](values []T, iteratee func(value T, index int) K) map[K][]T
func Includes[K comparable](values []K, value K) bool
func IndexOf[T comparable](collection []T, value T) int
func Last[T any](collection []T) T
func LastIndexOf[T comparable](collection []T, value T) int
func Map[K any, R any](values []K, fn func(value K, index int) R) []R
func Max[T Number](collection []T) T
func Min[T Number](collection []T) T
func Reduce[K any, R any](values []K, fn func(all R, value K, index int) R, initialValue R) R
func Repeat[T any](count int, value T) []T
func Reverse[T any](collection []T) []T
func Shuffle[T any](collection []T) []T
func UniqueBy[T any, U comparable](collection []T, iteratee func(value T, index int) U) []T
type Number interface{ ... }
Object
func Get[K comparable, V any](object map[K]V, key string) V
func Indexes[K comparable, V any](object map[K]V) map[string]V
func Keys[K comparable, V any](object map[K]V) []K
func Map[K comparable, V any](object map[K]V, iteratee func(V, K) V) map[K]V
func Omit[K comparable, V any](object map[K]V, keys ...K) map[K]V
func OmitBy[K comparable, V any](object map[K]V, fn func(V, K) bool) map[K]V
func Pick[K comparable, V any](object map[K]V, keys ...K) map[K]V
func PickBy[K comparable, V any](object map[K]V, fn func(V, K) bool) map[K]V
func ToMap(in any, tag ...string) (map[string]any, error)
func Values[K comparable, V any](object map[K]V) []V
func Walk[K comparable, V any](object map[K]V, fn func(V, K, string))
func WalkByDeepFirst[K comparable, V any](object map[K]V, fn func(V, K, string), parent string)

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "1.4.7"

Version ...

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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