Refactor Value::is_true()
This commit is contained in:
parent
29917d95d4
commit
789c55ac3d
@ -226,8 +226,11 @@ impl Value {
|
||||
}
|
||||
|
||||
pub fn is_true(&self) -> bool {
|
||||
let s = self.eval();
|
||||
!(s == Value::Null || s == Value::False)
|
||||
match self {
|
||||
Value::Null | Value::False => false,
|
||||
Self::BinaryOp(..) => self.eval().is_true(),
|
||||
_ => true
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unquote(self) -> Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user