Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Add From<f32> for JsValue #1990

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions boa_engine/src/value/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ impl From<f64> for JsValue {
}
}

impl From<f32> 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())
// }
jedel1043 marked this conversation as resolved.
Show resolved Hide resolved
}
}

impl From<u32> for JsValue {
#[inline]
fn from(value: u32) -> Self {
Expand Down