Files
monkey/object/builtin_lower.go
Chuck Smith 99cea83f57
Some checks failed
Test / build (push) Waiting to run
Build / build (push) Has been cancelled
Add tons of builtin helpers and array operations.
2024-03-24 12:11:46 -04:00

17 lines
352 B
Go

package object
import "strings"
// Lower ...
func Lower(args ...Object) Object {
if len(args) != 1 {
return newError("wrong number of arguments. got=%d, want=1",
len(args))
}
if str, ok := args[0].(*String); ok {
return &String{Value: strings.ToLower(str.Value)}
}
return newError("expected `str` argument to `lower` got=%T", args[0])
}