1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

LibJS: Support BigInt number formatting with Intl.NumberFormat

This commit is contained in:
Timothy Flynn 2022-01-30 13:00:09 -05:00 committed by Linus Groh
parent a0253af8c1
commit d6e926e5b1
5 changed files with 171 additions and 45 deletions

View file

@ -44,10 +44,6 @@ ThrowCompletionOr<Value> NumberFormatFunction::call()
// 4. Let x be ? ToNumeric(value).
value = TRY(value.to_numeric(global_object));
// FIXME: Support BigInt number formatting.
if (value.is_bigint())
return vm.throw_completion<InternalError>(global_object, ErrorType::NotImplemented, "BigInt number formatting");
// 5. Return ? FormatNumeric(nf, x).
// Note: Our implementation of FormatNumeric does not throw.
auto formatted = format_numeric(global_object, m_number_format, value);