mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(ext/console): render properties of Intl.Locale (#24827)
Fixes #21271 --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
parent
4eda9e64e9
commit
6db5f1bb6e
2 changed files with 36 additions and 0 deletions
|
@ -790,6 +790,24 @@ function formatRaw(ctx, value, recurseTimes, typedArray, proxyDetails) {
|
|||
return ctx.stylize(base, "date");
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
proxyDetails === null &&
|
||||
ObjectPrototypeIsPrototypeOf(globalThis.Intl.Locale.prototype, value)
|
||||
) {
|
||||
braces[0] = `${getPrefix(constructor, tag, "Intl.Locale")}{`;
|
||||
ArrayPrototypeUnshift(
|
||||
keys,
|
||||
"baseName",
|
||||
"calendar",
|
||||
"caseFirst",
|
||||
"collation",
|
||||
"hourCycle",
|
||||
"language",
|
||||
"numberingSystem",
|
||||
"numeric",
|
||||
"region",
|
||||
"script",
|
||||
);
|
||||
} else if (
|
||||
proxyDetails === null &&
|
||||
typeof globalThis.Temporal !== "undefined" &&
|
||||
|
|
|
@ -1066,6 +1066,24 @@ Deno.test(async function consoleTestStringifyPromises() {
|
|||
assertEquals(strLines[1], " <rejected> Error: Whoops");
|
||||
});
|
||||
|
||||
Deno.test(function consoleTestStringifyIntlLocale() {
|
||||
assertEquals(
|
||||
stringify(new Intl.Locale("zh-Hant-TW", { hourCycle: "h12" })),
|
||||
`Locale [Intl.Locale] {
|
||||
baseName: "zh-Hant-TW",
|
||||
calendar: undefined,
|
||||
caseFirst: undefined,
|
||||
collation: undefined,
|
||||
hourCycle: "h12",
|
||||
language: "zh",
|
||||
numberingSystem: undefined,
|
||||
numeric: false,
|
||||
region: "TW",
|
||||
script: "Hant"
|
||||
}`,
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test(function consoleTestWithCustomInspector() {
|
||||
class A {
|
||||
[customInspect](
|
||||
|
|
Loading…
Reference in a new issue