From 9bcc65f375f42053de26bdbaeb97160d4264dd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Sun, 7 Jul 2024 01:38:52 +0200 Subject: [PATCH] js: Add Value::is_undefined --- crates/js/src/value/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/js/src/value/mod.rs b/crates/js/src/value/mod.rs index 92acb480..8ab81f83 100644 --- a/crates/js/src/value/mod.rs +++ b/crates/js/src/value/mod.rs @@ -108,6 +108,11 @@ impl Value { matches!(self, Self::Object(_)) } + #[must_use] + pub const fn is_undefined(&self) -> bool { + matches!(self, Self::Undefined) + } + #[must_use] pub fn as_string(&self) -> Option<&str> { if let Self::String(s) = self {