1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +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:
Andreas Kling 2020-12-05 13:51:09 +01:00
parent 4ae0de9a37
commit e6dadd9e5b
5 changed files with 125 additions and 3 deletions

View file

@ -168,6 +168,7 @@ namespace JS {
P(padStart) \
P(parse) \
P(parseFloat) \
P(parseInt) \
P(pop) \
P(pow) \
P(preventExtensions) \