|
@@ -5,6 +5,7 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
#include <LibJS/Runtime/AbstractOperations.h>
|
|
#include <LibJS/Runtime/AbstractOperations.h>
|
|
|
|
+#include <LibJS/Runtime/Array.h>
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
#include <LibJS/Runtime/Intl/AbstractOperations.h>
|
|
#include <LibJS/Runtime/Intl/AbstractOperations.h>
|
|
#include <LibJS/Runtime/Intl/NumberFormat.h>
|
|
#include <LibJS/Runtime/Intl/NumberFormat.h>
|
|
@@ -390,6 +391,10 @@ void NumberFormatConstructor::initialize(GlobalObject& global_object)
|
|
|
|
|
|
// 15.3.1 Intl.NumberFormat.prototype, https://tc39.es/ecma402/#sec-intl.numberformat.prototype
|
|
// 15.3.1 Intl.NumberFormat.prototype, https://tc39.es/ecma402/#sec-intl.numberformat.prototype
|
|
define_direct_property(vm.names.prototype, global_object.intl_number_format_prototype(), 0);
|
|
define_direct_property(vm.names.prototype, global_object.intl_number_format_prototype(), 0);
|
|
|
|
+
|
|
|
|
+ u8 attr = Attribute::Writable | Attribute::Configurable;
|
|
|
|
+ define_native_function(vm.names.supportedLocalesOf, supported_locales_of, 1, attr);
|
|
|
|
+
|
|
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
|
|
define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -427,4 +432,21 @@ Value NumberFormatConstructor::construct(FunctionObject& new_target)
|
|
return number_format;
|
|
return number_format;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 15.3.2 Intl.NumberFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.numberformat.supportedlocalesof
|
|
|
|
+JS_DEFINE_NATIVE_FUNCTION(NumberFormatConstructor::supported_locales_of)
|
|
|
|
+{
|
|
|
|
+ auto locales = vm.argument(0);
|
|
|
|
+ auto options = vm.argument(1);
|
|
|
|
+
|
|
|
|
+ // 1. Let availableLocales be %NumberFormat%.[[AvailableLocales]].
|
|
|
|
+
|
|
|
|
+ // 2. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
|
|
|
+ auto requested_locales = canonicalize_locale_list(global_object, locales);
|
|
|
|
+ if (vm.exception())
|
|
|
|
+ return {};
|
|
|
|
+
|
|
|
|
+ // 3. Return ? SupportedLocales(availableLocales, requestedLocales, options).
|
|
|
|
+ return supported_locales(global_object, requested_locales, options);
|
|
|
|
+}
|
|
|
|
+
|
|
}
|
|
}
|