From 052aaf6e978d8b0a0fa24cdb804fc13f11c09386 Mon Sep 17 00:00:00 2001 From: SindreXie Date: Wed, 3 Aug 2022 11:11:56 +0800 Subject: [PATCH] error: use ES2020 statement --- lib/internal/errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index df079d2952b47e..d2d12d2838a591 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1335,7 +1335,7 @@ E('ERR_INVALID_RETURN_PROPERTY', (input, name, prop, value) => { }, TypeError); E('ERR_INVALID_RETURN_PROPERTY_VALUE', (input, name, prop, value) => { let type; - if (value && value.constructor && value.constructor.name) { + if (value?.constructor?.name) { type = `instance of ${value.constructor.name}`; } else { type = `type ${typeof value}`;