Bool returns the boolean state associated with the given value, or the value "def", if the value is blank. The "boolean state associated with a given key" is defined as the case-insensitive string comparison with the following: 1. true if... "true", "1", "on", "yes", or "t" 2. false if... "false",
(value string, def bool)
| 112 | // 2. false if... |
| 113 | // "false", "0", "off", "no", "f", or otherwise. |
| 114 | func Bool(value string, def bool) bool { |
| 115 | if len(value) == 0 { |
| 116 | return def |
| 117 | } |
| 118 | |
| 119 | switch strings.ToLower(value) { |
| 120 | case "true", "1", "on", "yes", "t": |
| 121 | return true |
| 122 | case "false", "0", "off", "no", "f": |
| 123 | return false |
| 124 | default: |
| 125 | return false |
| 126 | } |
| 127 | } |
no outgoing calls
no test coverage detected