Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master Squashed commit of the following: commit cfe2c02a7bb727e81fcd91674aa777df37413a8e Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Jan 24 18:12:32 2023 +0300 all: use mathutil
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/AdguardTeam/golibs/mathutil"
|
||||
)
|
||||
|
||||
// NullBool is a nullable boolean. Use these in JSON requests and responses
|
||||
@@ -33,11 +35,7 @@ func (nb NullBool) String() (s string) {
|
||||
|
||||
// BoolToNullBool converts a bool into a NullBool.
|
||||
func BoolToNullBool(cond bool) (nb NullBool) {
|
||||
if cond {
|
||||
return NBTrue
|
||||
}
|
||||
|
||||
return NBFalse
|
||||
return NBFalse - mathutil.BoolToNumber[NullBool](cond)
|
||||
}
|
||||
|
||||
// type check
|
||||
|
||||
Reference in New Issue
Block a user