Skip to content

Commit 8f7d601

Browse files
committed
feat: add methods to check if OwnedJsValue is BigInt and ShortBigInt
1 parent 8298fcc commit 8f7d601

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/value/value.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ impl OwnedJsValue {
126126
self.tag() == JsTag::Int
127127
}
128128

129+
/// Check if this value is `BigInt`.
130+
#[inline]
131+
#[cfg(feature = "bigint")]
132+
pub fn is_bigint(&self) -> bool {
133+
self.tag() == JsTag::BigInt || self.tag() == JsTag::ShortBigInt
134+
}
135+
136+
/// Check if this value is `BigInt`, but short enough to fit in a i32
137+
#[inline]
138+
#[cfg(feature = "bigint")]
139+
pub fn is_short_bigint(&self) -> bool {
140+
self.tag() == JsTag::ShortBigInt
141+
}
142+
129143
/// Check if this value is `float`.
130144
#[inline]
131145
pub fn is_float(&self) -> bool {

0 commit comments

Comments
 (0)