Skip to content

Commit

Permalink
fix(js): allow convert from undefined to LoroValue (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
zxch3n authored Apr 18, 2024
1 parent 2fc4420 commit a32b75a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/loro-common/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ pub mod wasm {

impl From<JsValue> for LoroValue {
fn from(js_value: JsValue) -> Self {
if js_value.is_null() {
if js_value.is_null() || js_value.is_undefined() {
LoroValue::Null
} else if js_value.as_bool().is_some() {
LoroValue::Bool(js_value.as_bool().unwrap())
Expand Down Expand Up @@ -450,7 +450,7 @@ pub mod wasm {

LoroValue::Map(Arc::new(map))
} else {
unreachable!()
panic!("Fail to convert JsValue {:?} to LoroValue ", js_value)
}
}
}
Expand Down

0 comments on commit a32b75a

Please sign in to comment.