1use super::JsValue;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub enum Type {
6 Undefined,
7 Null,
8 Boolean,
9 Number,
10 String,
11 Symbol,
12 BigInt,
13 Object,
14}
15
16impl JsValue {
17 pub fn get_type(&self) -> Type {
24 match *self {
25 Self::Rational(_) | Self::Integer(_) => Type::Number,
26 Self::String(_) => Type::String,
27 Self::Boolean(_) => Type::Boolean,
28 Self::Symbol(_) => Type::Symbol,
29 Self::Null => Type::Null,
30 Self::Undefined => Type::Undefined,
31 Self::BigInt(_) => Type::BigInt,
32 Self::Object(_) => Type::Object,
33 }
34 }
35}