util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package util provides shared utility functions used across the skill-validator codebase: number formatting, pluralization, rounding, sorted-key extraction, and ANSI color helpers.

Index

Constants

View Source
const (
	// ColorReset disables all ANSI text attributes.
	ColorReset = "\033[0m"
	// ColorBold enables bold text.
	ColorBold = "\033[1m"
	// ColorRed sets the text color to red.
	ColorRed = "\033[31m"
	// ColorGreen sets the text color to green.
	ColorGreen = "\033[32m"
	// ColorYellow sets the text color to yellow.
	ColorYellow = "\033[33m"
	// ColorCyan sets the text color to cyan.
	ColorCyan = "\033[36m"
)

Variables

This section is empty.

Functions

func FormatNumber

func FormatNumber(n int) string

FormatNumber formats an integer with thousand-separator commas.

func PluralS

func PluralS(n int) string

PluralS returns "s" when n != 1, empty string otherwise.

func RoundTo

func RoundTo(val float64, places int) float64

RoundTo rounds val to the given number of decimal places.

func SkillNameFromDir

func SkillNameFromDir(dir string) string

SkillNameFromDir derives a skill name from a directory path.

func SortedKeys

func SortedKeys[V any](m map[string]V) []string

SortedKeys returns the keys of any map[string]V sorted alphabetically.

func YSuffix

func YSuffix(n int) string

YSuffix returns "y" when n == 1, "ies" otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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