mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-01 15:56:19 +00:00
6
vendor/github.com/d5/tengo/.goreleaser.yml
generated
vendored
6
vendor/github.com/d5/tengo/.goreleaser.yml
generated
vendored
@ -1,3 +1,8 @@
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
@ -9,6 +14,7 @@ builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/tengomin/main.go
|
||||
id: tengomin
|
||||
binary: tengomin
|
||||
goos:
|
||||
- darwin
|
||||
|
0
vendor/github.com/d5/tengo/go.sum
generated
vendored
Normal file
0
vendor/github.com/d5/tengo/go.sum
generated
vendored
Normal file
20
vendor/github.com/d5/tengo/stdlib/base64.go
generated
vendored
Normal file
20
vendor/github.com/d5/tengo/stdlib/base64.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"github.com/d5/tengo/objects"
|
||||
)
|
||||
|
||||
var base64Module = map[string]objects.Object{
|
||||
"encode": &objects.UserFunction{Value: FuncAYRS(base64.StdEncoding.EncodeToString)},
|
||||
"decode": &objects.UserFunction{Value: FuncASRYE(base64.StdEncoding.DecodeString)},
|
||||
|
||||
"raw_encode": &objects.UserFunction{Value: FuncAYRS(base64.RawStdEncoding.EncodeToString)},
|
||||
"raw_decode": &objects.UserFunction{Value: FuncASRYE(base64.RawStdEncoding.DecodeString)},
|
||||
|
||||
"url_encode": &objects.UserFunction{Value: FuncAYRS(base64.URLEncoding.EncodeToString)},
|
||||
"url_decode": &objects.UserFunction{Value: FuncASRYE(base64.URLEncoding.DecodeString)},
|
||||
|
||||
"raw_url_encode": &objects.UserFunction{Value: FuncAYRS(base64.RawURLEncoding.EncodeToString)},
|
||||
"raw_url_decode": &objects.UserFunction{Value: FuncASRYE(base64.RawURLEncoding.DecodeString)},
|
||||
}
|
2
vendor/github.com/d5/tengo/stdlib/builtin_modules.go
generated
vendored
2
vendor/github.com/d5/tengo/stdlib/builtin_modules.go
generated
vendored
@ -11,4 +11,6 @@ var BuiltinModules = map[string]map[string]objects.Object{
|
||||
"rand": randModule,
|
||||
"fmt": fmtModule,
|
||||
"json": jsonModule,
|
||||
"base64": base64Module,
|
||||
"hex": hexModule,
|
||||
}
|
||||
|
53
vendor/github.com/d5/tengo/stdlib/func_typedefs.go
generated
vendored
53
vendor/github.com/d5/tengo/stdlib/func_typedefs.go
generated
vendored
@ -1036,6 +1036,29 @@ func FuncAYRIE(fn func([]byte) (int, error)) objects.CallableFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// FuncAYRS transform a function of 'func([]byte) string' signature
|
||||
// into CallableFunc type.
|
||||
func FuncAYRS(fn func([]byte) string) objects.CallableFunc {
|
||||
return func(args ...objects.Object) (ret objects.Object, err error) {
|
||||
if len(args) != 1 {
|
||||
return nil, objects.ErrWrongNumArguments
|
||||
}
|
||||
|
||||
y1, ok := objects.ToByteSlice(args[0])
|
||||
if !ok {
|
||||
return nil, objects.ErrInvalidArgumentType{
|
||||
Name: "first",
|
||||
Expected: "bytes(compatible)",
|
||||
Found: args[0].TypeName(),
|
||||
}
|
||||
}
|
||||
|
||||
res := fn(y1)
|
||||
|
||||
return &objects.String{Value: res}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// FuncASRIE transform a function of 'func(string) (int, error)' signature
|
||||
// into CallableFunc type.
|
||||
func FuncASRIE(fn func(string) (int, error)) objects.CallableFunc {
|
||||
@ -1062,6 +1085,36 @@ func FuncASRIE(fn func(string) (int, error)) objects.CallableFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// FuncASRYE transform a function of 'func(string) ([]byte, error)' signature
|
||||
// into CallableFunc type.
|
||||
func FuncASRYE(fn func(string) ([]byte, error)) objects.CallableFunc {
|
||||
return func(args ...objects.Object) (ret objects.Object, err error) {
|
||||
if len(args) != 1 {
|
||||
return nil, objects.ErrWrongNumArguments
|
||||
}
|
||||
|
||||
s1, ok := objects.ToString(args[0])
|
||||
if !ok {
|
||||
return nil, objects.ErrInvalidArgumentType{
|
||||
Name: "first",
|
||||
Expected: "string(compatible)",
|
||||
Found: args[0].TypeName(),
|
||||
}
|
||||
}
|
||||
|
||||
res, err := fn(s1)
|
||||
if err != nil {
|
||||
return wrapError(err), nil
|
||||
}
|
||||
|
||||
if len(res) > tengo.MaxBytesLen {
|
||||
return nil, objects.ErrBytesLimit
|
||||
}
|
||||
|
||||
return &objects.Bytes{Value: res}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// FuncAIRSsE transform a function of 'func(int) ([]string, error)' signature
|
||||
// into CallableFunc type.
|
||||
func FuncAIRSsE(fn func(int) ([]string, error)) objects.CallableFunc {
|
||||
|
11
vendor/github.com/d5/tengo/stdlib/hex.go
generated
vendored
Normal file
11
vendor/github.com/d5/tengo/stdlib/hex.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
package stdlib
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"github.com/d5/tengo/objects"
|
||||
)
|
||||
|
||||
var hexModule = map[string]objects.Object{
|
||||
"encode": &objects.UserFunction{Value: FuncAYRS(hex.EncodeToString)},
|
||||
"decode": &objects.UserFunction{Value: FuncASRYE(hex.DecodeString)},
|
||||
}
|
Reference in New Issue
Block a user