mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibJS: Implement parseInt()
Here's a reasonably faithful implementation of ECMAScript 2021 18.2.5. Some corner cases are not covered, I've left them as FIXME's in the included unit test. Also I had to tweak JS::Value::to_i32() to always convert infinity to zero, which is in accordance with ToInt32 AFAICT.
This commit is contained in:
parent
4ae0de9a37
commit
e6dadd9e5b
5 changed files with 125 additions and 3 deletions
|
@ -82,6 +82,7 @@ private:
|
|||
JS_DECLARE_NATIVE_FUNCTION(is_nan);
|
||||
JS_DECLARE_NATIVE_FUNCTION(is_finite);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse_float);
|
||||
JS_DECLARE_NATIVE_FUNCTION(parse_int);
|
||||
|
||||
NonnullOwnPtr<Console> m_console;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue