File: base.go

package info (click to toggle)
golang-github-evilsocket-islazy 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292 kB
  • sloc: javascript: 8; makefile: 3
file content (10 lines) | stat: -rw-r--r-- 258 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
package ops

// Ternary is the standard ternary operator which returns posVal
// if the boolean condition is true, otherwise negVal.
func Ternary(cond bool, posVal interface{}, negVal interface{}) interface{} {
	if cond {
		return posVal
	}
	return negVal
}