util

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package util provides various things used by other packages in this module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteLowercase

func ByteLowercase(str string) string

ByteLowercase returns a byte-lowercase version of str.

func Errorf

func Errorf(format string, a ...any) error

Errorf is similar to fmt.Errorf, but the message of the resulting error is prefixed with "cors: ".

func InvalidOriginPatternErr

func InvalidOriginPatternErr(str string) error

InvalidOriginPatternErr returns an error about invalid origin pattern str.

func Join

func Join(w io.StringWriter, strs []string)

Join joins the elements of strs in a human-friendly way and writes the result to w.

func NewError

func NewError(text string) error

NewError is similar to errors.New, but the message of the resulting error is prefixed with "cors: ".

Types

type Set

type Set[E int | string] map[E]struct{}

A Set represents a mathematical set of ints or strings.

func NewSet

func NewSet[E int | string](first E, rest ...E) Set[E]

NewSet returns a Set that contains first and all elements of rest, but no other elements.

func (Set[E]) Add

func (s Set[E]) Add(e E)

Add adds e to s.

func (Set[E]) Contains

func (s Set[E]) Contains(e E) bool

Contains returns true if e is an element of s, and false otherwise.

Jump to

Keyboard shortcuts

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