LibJS: Add Value::to_double() for convenience

This commit is contained in:
Andreas Kling 2020-04-08 11:22:20 +02:00
commit 2ffa054574
Notes: sideshowbarker 2024-07-19 07:48:42 +09:00
2 changed files with 6 additions and 0 deletions

View file

@ -170,6 +170,11 @@ i32 Value::to_i32() const
return static_cast<i32>(to_number().as_double());
}
double Value::to_double() const
{
return to_number().as_double();
}
Value greater_than(Value lhs, Value rhs)
{
return Value(lhs.to_number().as_double() > rhs.to_number().as_double());