1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-26 23:24:38 +01:00
liquid/drops.go

18 lines
415 B
Go
Raw Normal View History

2017-07-03 18:00:43 +02:00
package liquid
// Drop indicates that the object will present to templates as its ToLiquid value.
type Drop interface {
ToLiquid() interface{}
}
2017-07-11 17:36:51 +02:00
// FromDrop returns returns object.ToLiquid() if object's type implement this function;
// else the object itself.
func FromDrop(object interface{}) interface{} {
switch object := object.(type) {
case Drop:
return object.ToLiquid()
default:
return object
}
}