Add tons of builtin helpers and array operations.
Some checks failed
Test / build (push) Waiting to run
Build / build (push) Has been cancelled

This commit is contained in:
Chuck Smith
2024-03-24 12:11:46 -04:00
parent c9d96236dd
commit 99cea83f57
23 changed files with 413 additions and 49 deletions

16
object/builtin_lower.go Normal file
View File

@@ -0,0 +1,16 @@
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])
}