From f2d38f10c0b03734c989ba1dd1088dae23b8696f Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Mon, 7 Oct 2024 11:27:39 -0400 Subject: [PATCH] fix: Handle nullish coalescing operator --- bin/node-gyp.js | 2 +- lib/log.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/node-gyp.js b/bin/node-gyp.js index f8317b4..7d43fed 100755 --- a/bin/node-gyp.js +++ b/bin/node-gyp.js @@ -78,7 +78,7 @@ async function run () { } try { - const args = await prog.commands[command.name](command.args) ?? [] + const args = await prog.commands[command.name](command.args) || [] if (command.name === 'list') { if (args.length) { diff --git a/lib/log.js b/lib/log.js index 2887abb..4ddc505 100644 --- a/lib/log.js +++ b/lib/log.js @@ -89,15 +89,15 @@ class Logger { } get level () { - return this.#levels.get(this.#level) ?? null + return this.#levels.get(this.#level) || null } set level (level) { - this.#level = this.#levels.get(level)?.id ?? null + this.#level = this.#levels.get(level)?.id || null } isVisible (level) { - return this.level?.index <= this.#levels.get(level)?.index ?? -1 + return this.level?.index <= this.#levels.get(level)?.index || -1 } #onLog (...args) { @@ -144,7 +144,7 @@ class Logger { const prefixParts = [ this.#color('gyp', { fg: 'white', bg: 'black' }), - this.#color(level.display ?? level.id, level.style) + this.#color(level.display || level.id, level.style) ] if (msgPrefix) { prefixParts.push(this.#color(msgPrefix, { fg: 'magenta' }))