mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
LibJS: Port trivial use cases in the Intl namespace to String
This commit is contained in:
parent
edfdade9e9
commit
fc413711ee
18 changed files with 72 additions and 70 deletions
|
@ -67,7 +67,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> DurationFormatConstructor::construct(Fun
|
|||
// 7. If numberingSystem is not undefined, then
|
||||
if (!numbering_system.is_undefined()) {
|
||||
// a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
|
||||
if (!::Locale::is_type_identifier(TRY(numbering_system.as_string().deprecated_string())))
|
||||
if (!::Locale::is_type_identifier(TRY(numbering_system.as_string().utf8_string_view())))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, numbering_system, "numberingSystem"sv);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> DurationFormatConstructor::construct(Fun
|
|||
auto style = TRY(get_option(vm, *options, vm.names.style, OptionType::String, { "long"sv, "short"sv, "narrow"sv, "digital"sv }, "short"sv));
|
||||
|
||||
// 14. Set durationFormat.[[Style]] to style.
|
||||
duration_format->set_style(TRY(style.as_string().deprecated_string()));
|
||||
duration_format->set_style(TRY(style.as_string().utf8_string_view()));
|
||||
|
||||
// 15. Set durationFormat.[[DataLocale]] to r.[[dataLocale]].
|
||||
duration_format->set_data_locale(move(result.data_locale));
|
||||
|
@ -119,7 +119,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> DurationFormatConstructor::construct(Fun
|
|||
auto digital_base = duration_instances_component.digital_default;
|
||||
|
||||
// f. Let unitOptions be ? GetDurationUnitOptions(unit, options, style, valueList, digitalBase, prevStyle).
|
||||
auto unit_options = TRY(get_duration_unit_options(vm, unit, *options, TRY(style.as_string().deprecated_string()), value_list, digital_base, previous_style));
|
||||
auto unit_options = TRY(get_duration_unit_options(vm, unit, *options, TRY(style.as_string().utf8_string_view()), value_list, digital_base, previous_style));
|
||||
|
||||
// g. Set the value of the styleSlot slot of durationFormat to unitOptions.[[Style]].
|
||||
(duration_format->*style_slot)(unit_options.style);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue