package utils

import "github.com/compose-spec/compose-go/v2/utils"

Index

Functions

func ArrayContains

func ArrayContains[T comparable](source []T, toCheck []T) bool

func GetAsEqualsMap

func GetAsEqualsMap(em []string) map[string]string

GetAsEqualsMap split key=value formatted strings into a key : value map

func GetAsStringList

func GetAsStringList(em map[string]string) []string

GetAsEqualsMap format a key : value map into key=value strings

func MapKeys

func MapKeys[T constraints.Ordered, U any](theMap map[T]U) []T

func MapsAppend

func MapsAppend[T comparable, U any](target map[T]U, source map[T]U) map[T]U

func StringToBool

func StringToBool(s string) bool

StringToBool converts a string to a boolean ignoring errors

Types

type Set

type Set[T comparable] map[T]struct{}

func NewSet

func NewSet[T comparable](v ...T) Set[T]

func (Set[T]) Add

func (s Set[T]) Add(v T)

func (Set[T]) AddAll

func (s Set[T]) AddAll(v ...T)

func (Set[T]) Clear

func (s Set[T]) Clear()

func (Set[T]) Diff

func (s Set[T]) Diff(other Set[T]) Set[T]

func (Set[T]) Elements

func (s Set[T]) Elements() []T

func (Set[T]) Has

func (s Set[T]) Has(v T) bool

func (Set[T]) Remove

func (s Set[T]) Remove(v T) bool

func (Set[T]) RemoveAll

func (s Set[T]) RemoveAll(elements ...T)

func (Set[T]) Union

func (s Set[T]) Union(other Set[T]) Set[T]

Source Files

collectionutils.go set.go stringutils.go

Version
v2.0.0-beta.3
Published
Jan 10, 2024
Platform
js/wasm
Imports
6 packages
Last checked
52 minutes ago

Tools for package owners.