Skip to content

Adds Number to_fixed and to_exponential function #305

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
merged 4 commits into from
Jun 24, 2018

Conversation

sendilkumarn
Copy link
Member

No description provided.

src/js.rs Outdated
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
#[wasm_bindgen(catch, method, js_name = toFixed)]
pub fn to_fixed(this: &Number, digits: u8) -> Result<String, JsValue>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please return JsStrings rather than Strings. Returning Strings forces us to copy into wasm memory every time a method is called. I just merged a pull request that makes it easy to convert to and from JsString and String, you might want to merged that to make it easier to write tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the new change. Done 👍

@ohanar
Copy link
Member

ohanar commented Jun 24, 2018

Thanks @sendilkumarn!

@ohanar ohanar merged commit 7936e1e into rustwasm:master Jun 24, 2018
@sendilkumarn sendilkumarn deleted the number-fixed-exponential branch June 25, 2018 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants