mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +02:00
e6d692010c
Added string functions to standard library
27 lines
439 B
Go
27 lines
439 B
Go
package core
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
const MaxArgs = 65536
|
|
|
|
type Function = func(ctx context.Context, args ...Value) (Value, error)
|
|
|
|
func ValidateArgs(args []Value, minimum, maximum int) error {
|
|
count := len(args)
|
|
|
|
if count < minimum || count > maximum {
|
|
return Error(
|
|
ErrInvalidArgumentNumber,
|
|
fmt.Sprintf(
|
|
"expected number of arguments %d-%d, but got %d",
|
|
minimum,
|
|
maximum,
|
|
len(args)))
|
|
}
|
|
|
|
return nil
|
|
}
|