witer

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 2 Imported by: 0

README

Go Report Card test

witer

witer is a wrapper around Go's iter package, designed to simplify and extend its functionality for more convenient iteration handling.

Usage

Filter
import "github.com/hirokisan/witer"

iter := witer.New(slices.Values([]int64{1, 2, 3}))
items := iter.Filter(func(v int64) bool {
    return v%2 == 0
}).Collect()
import "github.com/hirokisan/witer"

iter := witer.New2(maps.All(map[int64]string{
    0: "a",
    1: "b",
    2: "c",
}))
items := maps.Collect(iter.Filter(func(k int64, v string) bool {
    return k%2 == 0 && v == "a"
}).Iter())
Apply
import "github.com/hirokisan/witer"

iter := witer.New(slices.Values([]int64{1, 2, 3}))
items := iter.Apply(func(v int64) int64 {
    return v * 10
}).Collect()
import "github.com/hirokisan/witer"

iter := witer.New2(maps.All(map[int64]string{
    0: "a",
    1: "b",
    2: "c",
}))
items := maps.Collect(iter.Apply(func(k int64, v string) (int64, string) {
    return k * 10, v
}).Iter())

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[V any](inner iter.Seq[V]) *witer[V]

func New2

func New2[K, V any](inner iter.Seq2[K, V]) *witer2[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