1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 07:24:38 +01:00
liquid/chunks/combinators.go
2017-06-29 07:54:31 -04:00

18 lines
385 B
Go

package chunks
// True returns true.
func True(_ Context) (interface{}, error) {
return true, nil
}
// Negate negates its argument.
func Negate(f func(Context) (interface{}, error)) func(Context) (interface{}, error) {
return func(ctx Context) (interface{}, error) {
value, err := f(ctx)
if err != nil {
return nil, err
}
return value == nil || value == false, nil
}
}