Skip to content

Commit

Permalink
Merge pull request #6 from electron/felixr-nullish
Browse files Browse the repository at this point in the history
fix: Handle nullish coalescing operator
  • Loading branch information
felixrieseberg authored Oct 7, 2024
2 parents 31e9059 + f2d38f1 commit 459130a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/node-gyp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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' }))
Expand Down

0 comments on commit 459130a

Please sign in to comment.