Browse Source

Merge pull request #5 from txgruppi/master

Updated to return bool false only for zero
tags/v1.0.0
Steve Francia 9 years ago
parent
commit
fb4a45a374
2 changed files with 2 additions and 1 deletions
  1. +1
    -0
      cast_test.go
  2. +1
    -1
      caste.go

+ 1
- 0
cast_test.go View File

@@ -63,4 +63,5 @@ func TestToBool(t *testing.T) {
assert.Equal(t, ToBool("T"), true)
assert.Equal(t, ToBool(1), true)
assert.Equal(t, ToBool(true), true)
assert.Equal(t, ToBool(-1), true)
}

+ 1
- 1
caste.go View File

@@ -41,7 +41,7 @@ func ToBoolE(i interface{}) (bool, error) {
case nil:
return false, nil
case int:
if i.(int) > 0 {
if i.(int) != 0 {
return true, nil
}
return false, nil


Loading…
Cancel
Save