summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Value.h
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Runtime/Value.h')
-rw-r--r--Libraries/LibJS/Runtime/Value.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h
index 691e15f487..3eccd5cfbe 100644
--- a/Libraries/LibJS/Runtime/Value.h
+++ b/Libraries/LibJS/Runtime/Value.h
@@ -57,6 +57,13 @@ public:
bool is_nan() const { return is_number() && __builtin_isnan(as_double()); }
bool is_infinity() const { return is_number() && __builtin_isinf(as_double()); }
+ bool is_finite_number() const
+ {
+ if (!is_number())
+ return false;
+ auto number = as_double();
+ return !__builtin_isnan(number) && !__builtin_isinf(number);
+ }
Value()
: m_type(Type::Empty)