iterutil

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 1 Imported by: 3

README

iterutil

Usage

go get github.com/tingtt/iterutil
import "github.com/tingtt/iterutil"
  • Filter
    for item := range iterutil.Filter(slices.Values([]int{1, 2, 3, 4, 5}), 3) {
      fmt.Println(item)
      break
    }
    // will print:
    // 3
    
  • FilterFunc
    filterLargerThanOrEqual := func(i int) func(v int) bool {
      return func(v int) bool {
        return v > i
      }
    }
    for item := range iterutil.FilterFunc(slices.Values([]int{1, 2, 3, 4, 5}), filterLargerThanOrEqual(3)) {
      fmt.Println(item)
    }
    // will print:
    // 3
    // 4
    // 5
    
  • FilterKey
  • FilterKeyFunc
  • FilterValue
  • FilterValueFunc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[V comparable](S iter.Seq[V], matchValue V) iter.Seq[V]

func FilterFunc

func FilterFunc[V any](S iter.Seq[V], match func(V) bool) iter.Seq[V]

func FilterKey

func FilterKey[K comparable, V any](S iter.Seq2[K, V], matchKey K) iter.Seq2[K, V]

func FilterKeyFunc

func FilterKeyFunc[K, V any](S iter.Seq2[K, V], match func(K) bool) iter.Seq2[K, V]

func FilterValue

func FilterValue[K any, V comparable](S iter.Seq2[K, V], matchValue V) iter.Seq2[K, V]

func FilterValueFunc

func FilterValueFunc[K, V any](S iter.Seq2[K, V], match func(V) bool) iter.Seq2[K, V]

Types

This section is empty.

Jump to

Keyboard shortcuts

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