checker/upper.go
Onur Cinar 4a77e34c92
Doc automation. (#126)
# Describe Request

Doc automation.

# Change Type

Doc update.
2024-10-29 21:10:40 -07:00

30 lines
697 B
Go

// Copyright (c) 2023-2024 Onur Cinar.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// https://github.com/cinar/checker
package checker
import (
"reflect"
"strings"
)
// tagUpper is the tag of the normalizer.
const tagUpper = "upper"
// makeUpper makes a normalizer function for the upper normalizer.
func makeUpper(_ string) CheckFunc {
return normalizeUpper
}
// normalizeUpper maps all Unicode letters in the given value to their upper case.
func normalizeUpper(value, _ reflect.Value) error {
if value.Kind() != reflect.String {
panic("string expected")
}
value.SetString(strings.ToUpper(value.String()))
return nil
}