apply

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Unlicense Imports: 0 Imported by: 3

Documentation

Overview

Package apply has functions to apply transformations to slices, maps, and channels TODO indexed

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToChannel

func ToChannel[T any, U any](c <-chan T, f func(T) U) chan U

ToChannel creates a channel that has elements of the provided one, but with a transforming function applied. Does not consume the original channel, operates "on demand".

func ToKeys

func ToKeys[T comparable, U comparable, V any](m map[T]V, f func(T) U) map[U]V

ToKeys applies a transforming function to a map's keys, returning a map with keys of the return type of the function

func ToSlice

func ToSlice[T, U any](s []T, f func(T) U) []U

ToSlice applies a transforming function to a slice's elements, returning a slice with the return type of the function

func ToValues

func ToValues[T comparable, U any, V any](m map[T]U, f func(U) V) map[T]V

ToValues applies a transforming function to a map's values, returning a map with values of the return type of the function

Types

This section is empty.

Jump to

Keyboard shortcuts

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