From 6baf4550880a5c7a202c51c9b8314ff977afade1 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Sat, 2 Apr 2022 22:11:16 +0000 Subject: [PATCH] Add From for JsValue (#1990) This Pull Request fixes/closes #1989. It changes the following: - Implements From for JsValue --- boa_engine/src/value/conversions.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/boa_engine/src/value/conversions.rs b/boa_engine/src/value/conversions.rs index 75fe285db8..ef2e7f8e8f 100644 --- a/boa_engine/src/value/conversions.rs +++ b/boa_engine/src/value/conversions.rs @@ -54,6 +54,18 @@ impl From for JsValue { } } +impl From for JsValue { + #[allow(clippy::float_cmp)] + #[inline] + fn from(value: f32) -> Self { + // if value as i32 as f32 == value { + // Self::Integer(value as i32) + // } else { + Self::Rational(value.into()) + // } + } +} + impl From for JsValue { #[inline] fn from(value: u32) -> Self {