Skip to content

Commit

Permalink
js: Add Value::is_undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwuelker committed Jul 6, 2024
1 parent 28a067a commit 9bcc65f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/js/src/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9bcc65f

Please sign in to comment.