LibJS: Make parseFloat slightly more specification-compliant
This commit is contained in:
parent
de2f5bb5a7
commit
27ca7bbbd7
Notes:
sideshowbarker
2024-07-17 20:42:21 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/27ca7bbbd7f Pull-request: https://github.com/SerenityOS/serenity/pull/11950 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg
1 changed files with 1 additions and 1 deletions
|
@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_float)
|
|||
if (vm.argument(0).is_number())
|
||||
return vm.argument(0);
|
||||
auto input_string = TRY(vm.argument(0).to_string(global_object));
|
||||
auto trimmed_string = input_string.trim_whitespace(TrimMode::Left);
|
||||
auto trimmed_string = MUST(trim_string(global_object, js_string(vm, input_string), TrimMode::Left));
|
||||
for (size_t length = trimmed_string.length(); length > 0; --length) {
|
||||
auto number = MUST(Value(js_string(vm, trimmed_string.substring(0, length))).to_number(global_object));
|
||||
if (!number.is_nan())
|
||||
|
|
Loading…
Add table
Reference in a new issue