x

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: MIT Imports: 2 Imported by: 2

README

X

A collection of functions to write concise code.

Package documentation

Other useful generic functions can be found at:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert added in v0.1.3

func Assert(message string, cond bool)

Assert panics with the given message if cond is false.

func Check

func Check(a ...any)

Check panics if one of its arguments is a non-nil error.

func Max added in v0.1.4

func Max[T constraints.Integer](x, y T) T

Max returns the larger of x or y.

func Min added in v0.1.4

func Min[T constraints.Integer](x, y T) T

Min returns the smaller of x or y.

func MultiLines added in v0.1.5

func MultiLines(s string) string

MultiLines formats a multiline raw string, changing:

`
	First line
		Second line
		Third line
`

to:

`First line
	Second line
	Third line`

It is intended to be called like this:

MultiLines(`
	First Line
		Second line
		Third line
`)

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v.

func Reverse

func Reverse[S ~[]E, E any](s S)

Reverse reverses a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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