summaryrefslogtreecommitdiff
path: root/ext/console/02_console.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-04-16 14:09:07 +0200
committerGitHub <noreply@github.com>2022-04-16 14:09:07 +0200
commit0bb96cde726127291dccb62145e76a50b2efcd2f (patch)
treee18e2512369c5c1393c2e45efef594e1e8ca4af5 /ext/console/02_console.js
parent8b31fc23cd80de9baa62535e95367da7a21c9cfd (diff)
refactor: update runtime code for primordial check x in y (#13642)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'ext/console/02_console.js')
-rw-r--r--ext/console/02_console.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/ext/console/02_console.js b/ext/console/02_console.js
index a16095179..d29bee801 100644
--- a/ext/console/02_console.js
+++ b/ext/console/02_console.js
@@ -107,6 +107,7 @@
ReflectGet,
ReflectGetOwnPropertyDescriptor,
ReflectGetPrototypeOf,
+ ReflectHas,
WeakMapPrototype,
WeakSetPrototype,
} = window.__bootstrap.primordials;
@@ -327,7 +328,10 @@
function inspectFunction(value, level, inspectOptions) {
const cyan = maybeColor(colors.cyan, inspectOptions);
- if (customInspect in value && typeof value[customInspect] === "function") {
+ if (
+ ReflectHas(value, customInspect) &&
+ typeof value[customInspect] === "function"
+ ) {
return String(value[customInspect](inspect));
}
// Might be Function/AsyncFunction/GeneratorFunction/AsyncGeneratorFunction
@@ -1203,7 +1207,10 @@
inspectOptions,
proxyDetails,
) {
- if (customInspect in value && typeof value[customInspect] === "function") {
+ if (
+ ReflectHas(value, customInspect) &&
+ typeof value[customInspect] === "function"
+ ) {
return String(value[customInspect](inspect));
}
// This non-unique symbol is used to support op_crates, ie.
@@ -1212,7 +1219,7 @@
// Internal only, shouldn't be used by users.
const privateCustomInspect = SymbolFor("Deno.privateCustomInspect");
if (
- privateCustomInspect in value &&
+ ReflectHas(value, privateCustomInspect) &&
typeof value[privateCustomInspect] === "function"
) {
// TODO(nayeemrmn): `inspect` is passed as an argument because custom
@@ -2048,8 +2055,8 @@
const valueObj = value || {};
const keys = properties || ObjectKeys(valueObj);
for (const k of keys) {
- if (!primitive && k in valueObj) {
- if (!(k in objectValues)) {
+ if (!primitive && ReflectHas(valueObj, k)) {
+ if (!(ReflectHas(objectValues, k))) {
objectValues[k] = ArrayPrototypeFill(new Array(numRows), "");
}
objectValues[k][idx] = stringifyValue(valueObj[k]);