zbools

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInterfaceNotBool = errors.New("encountered non-bool interface")
)

Functions

func As

func As(slice []interface{}) (res []bool, err error)

Convert a []interface{} slice into []bool slice if possible

func Contains

func Contains(haystack []bool, needle bool) bool

Check if a slice ([]bool) contains a matching member

func ContainsAll

func ContainsAll(haystack []bool, needles ...bool) bool

Check if a []bool slice contains ALL of the provided members

func ContainsAny

func ContainsAny(haystack []bool, needles ...bool) bool

Check if a []bool slice contains ANY of the provided members

func Cut

func Cut(slice []bool, separator bool) (left, right []bool, found bool)

Cut the slice into two slices separated by the separator

func CutAny

func CutAny(val []bool, seperators ...bool) (left, right []bool, found bool)

Cut the slice into two slices separated by the first separator

func Equal

func Equal(a []bool, b []bool) bool

Determine if two slices are equal to each other

func Index

func Index(haystack []bool, needle bool) int

Find the index where the needle appears. Returns -1 if the needle doesn't appear in the slice.

func Interface

func Interface(slice []bool) (res []interface{}, err error)

Convert a []bool slice into a slice of interfaces ([]interface{})

func Remove added in v0.5.10

func Remove(slice []bool, offset int, values ...bool) (res []bool)

Remove the first occurrence of each value from the slice starting from the supplied offset

func RemoveAt added in v0.5.10

func RemoveAt(slice []bool, index int) (res []bool)

Remove the item at the index while preserving the order of the items TODO: maybe change this to take multiple indices and to remove them at the same time

func Resize

func Resize(s []bool, n int) (res []bool)

Resize a slice to the given length

func Sort

func Sort(s []bool)

Sort the slice in ascending order

func SortReverse

func SortReverse(s []bool)

Sort the slice in descending order

func Split

func Split(slice []bool, separator bool) (parts [][]bool)

Split the slice into one or more slices separated by the separator

Types

This section is empty.

Jump to

Keyboard shortcuts

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