// When determines if the given condition is true then return the value or executes the given callback.
When determines if the given condition is true then return the value or executes the given callback.
// When determines if the given condition is true then return the value or executes the given callback .
func When(ok bool, value interface{}) interface{} {
	if !ok {
		return &MissingValue{}
	}
	if fn, ok := value.(func() interface{}); ok {
		return fn()
	}
	return value
}
func When ( ok bool , value interface { } ) interface { } { if ! ok { return & MissingValue { } } if fn , ok := value . ( func ( ) interface { } ) ; ok { return fn ( ) } return value }
When determines if the given condition is true then return the value or executes the given callback.
When determines if the given condition is true then return the value or executes the given callback .