mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
feat: 支持 RegExpr 与 Symbol 部分方法
This commit is contained in:
@@ -101,6 +101,9 @@ pub fn to_boolean(val: JsValue, string_forge: &StringForge) -> bool {
|
||||
if val.is_object() {
|
||||
return true;
|
||||
}
|
||||
if val.is_symbol() {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
@@ -172,6 +175,9 @@ pub fn strict_eq(lhs: JsValue, rhs: JsValue) -> bool {
|
||||
if lhs.is_object() && rhs.is_object() {
|
||||
return lhs.as_ptr() == rhs.as_ptr();
|
||||
}
|
||||
if lhs.is_symbol() && rhs.is_symbol() {
|
||||
return lhs.as_symbol_index() == rhs.as_symbol_index();
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
@@ -260,6 +266,9 @@ pub fn same_value(lhs: JsValue, rhs: JsValue) -> bool {
|
||||
if lhs.is_object() && rhs.is_object() {
|
||||
return lhs.as_ptr() == rhs.as_ptr();
|
||||
}
|
||||
if lhs.is_symbol() && rhs.is_symbol() {
|
||||
return lhs.as_symbol_index() == rhs.as_symbol_index();
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user