funcs

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a any, b ...any) (r any, err error)

Add returns the result of a + b[0] + b[1] ...

func Array

func Array(args ...any) []any

Array returns a []any{args[0], args[1], ...}

func CSS

func CSS(a any) (template.CSS, error)

func Comma

func Comma(n any, c ...string) (string, error)

Comma produces a string form of the given number in base 10 with commas after every three orders of magnitude.

e.g. Comma(834142) -> 834,142 e.g. Comma(834142, "_") -> 834_142

func Divide

func Divide(a any, b ...any) (r any, err error)

Divide returns the result of a / b[0] / b[1] ...

func HTML

func HTML(a any) (template.HTML, error)

func HTMLAttr

func HTMLAttr(a any) (template.HTMLAttr, error)

func HumanSize

func HumanSize(n any, p ...int) (string, error)

HumanSize returns a human-readable approximation of a size with specified precision digit numbers (default: 2) (eg. "2.75 MB", "796 KB").

func JS

func JS(a any) (template.JS, error)

func JSON

func JSON(a any) (template.JS, error)

JSON returns a json marshal string.

func JSStr

func JSStr(a any) (template.JSStr, error)

func Map

func Map(kvs ...any) (map[string]any, error)

Map returns a map[string]any{kvs[0]: kvs[1], kvs[2]: kvs[3], ...}

func Multiply

func Multiply(a any, b ...any) (r any, err error)

Multiply returns the result of a * b[0] * b[1] ...

func Srcset

func Srcset(a any) (template.Srcset, error)

func Strings added in v1.0.11

func Strings(args ...string) []string

Strings returns a []string{args[0], args[1], ...}

func Subtract

func Subtract(a any, b ...any) (r any, err error)

Subtract returns the result of a - b[0] - b[1] ...

func URL

func URL(a any) (template.URL, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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