utils

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImage

func GetImage(url string) (image.Image, error)

func JSON

func JSON(w http.ResponseWriter, status int, data map[string]interface{})

func WordWrap

func WordWrap(s string, limit int) []string

Literally all the existing word wrap implementations suck. They split by spaces so "aaa aaa" works but "aaaaaa" wouldn't get word wrapped. That is not how real word wrapping works. It should still put them on a newline. But we should also respect words so as to not cut words. E.g if "hello world" exceeded then "world" should be in a newline but not trimmed like "wo\nrld"

Types

This section is empty.

Jump to

Keyboard shortcuts

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