diff options
Diffstat (limited to 'ext/console/01_console.js')
-rw-r--r-- | ext/console/01_console.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js index ae629a432..101b7ed1c 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -188,6 +188,7 @@ const styles = { regexp: "red", module: "underline", internalError: "red", + temporal: "magenta", }; const defaultFG = 39; @@ -777,6 +778,55 @@ function formatRaw(ctx, value, recurseTimes, typedArray, proxyDetails) { } } } else if ( + proxyDetails === null && + typeof globalThis.Temporal !== "undefined" && + ( + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.Instant.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.ZonedDateTime.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.PlainDate.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.PlainTime.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.PlainDateTime.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.PlainYearMonth.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.PlainMonthDay.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.Duration.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.TimeZone.prototype, + value, + ) || + ObjectPrototypeIsPrototypeOf( + globalThis.Temporal.Calendar.prototype, + value, + ) + ) + ) { + // Temporal is not available in primordials yet + // deno-lint-ignore prefer-primordials + return ctx.stylize(value.toString(), "temporal"); + } else if ( (proxyDetails === null && (isNativeError(value) || ObjectPrototypeIsPrototypeOf(ErrorPrototype, value))) || |