mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 04:48:20 +02:00
Merge pull request #8 from electron/felixr-optional-chaining
fix: Handle optional chaining
This commit is contained in:
commit
9abc964e4f
1 changed files with 4 additions and 4 deletions
|
@ -93,11 +93,11 @@ class Logger {
|
|||
}
|
||||
|
||||
set level (level) {
|
||||
this.#level = this.#levels.get(level)?.id || null
|
||||
this.#level = (this.#levels.get(level) && this.#levels.get(level).id) || null
|
||||
}
|
||||
|
||||
isVisible (level) {
|
||||
return this.level?.index <= this.#levels.get(level)?.index || -1
|
||||
return (this.level && this.level.index <= (this.#levels.get(level) && this.#levels.get(level).index)) || -1
|
||||
}
|
||||
|
||||
#onLog (...args) {
|
||||
|
@ -124,7 +124,7 @@ class Logger {
|
|||
}
|
||||
|
||||
#color (str, { fg, bg, inverse }) {
|
||||
if (!this.#stream?.isTTY) {
|
||||
if (!this.#stream || !this.#stream.isTTY) {
|
||||
return str
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ class Logger {
|
|||
}
|
||||
|
||||
#log (levelId, msgPrefix, ...args) {
|
||||
if (!this.isVisible(levelId) || typeof this.#stream?.write !== 'function') {
|
||||
if (!this.isVisible(levelId) || (this.#stream && typeof this.#stream.write !== 'function')) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue