first

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package first provides helpers for retrieving a first element of a slice that satisfies a condition

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByPredicate

type ByPredicate[T any] struct {
	// contains filtered or unexported fields
}

ByPredicate is tail prducer of the first.By

func By

func By[T any](by func(T) bool) ByPredicate[T]

By the first part of an expression first.By(tester).Of(elements...)

func (ByPredicate[T]) Of

func (l ByPredicate[T]) Of(elements ...T) (T, bool)

Of the finish part of an expression first.By(tester).Of(elements...)

type OfElements

type OfElements[T any] struct {
	// contains filtered or unexported fields
}

OfElements is tail prducer of the first.Of

func Of

func Of[T any](elements ...T) OfElements[T]

Of the first part of an expression first.Of(elements...).By(tester)

func (OfElements[T]) By

func (l OfElements[T]) By(by func(T) bool) (T, bool)

By the finish part of an expression first.Of(elements...).By(tester)

func (OfElements[T]) Where

func (l OfElements[T]) Where(condition func(T) bool) (T, bool)

Where the finish part of an expression first.Of(elements...).Where(condition)

Jump to

Keyboard shortcuts

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