|
@@ -466,13 +466,22 @@ module.exports = class Computer {
|
|
|
console.log(outputMessage, util.inspect(toInspect, { breakLength: Infinity, colors: true, compact: true }));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Check if the computer has any values in the output array
|
|
|
+ *
|
|
|
+ * @returns {boolean} True or false if there are any values in the output array
|
|
|
+ */
|
|
|
+ HasOutput() {
|
|
|
+ return !!this.outputValues.length;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Get a value from the unhandled OUTPUT values in FIFO order
|
|
|
*
|
|
|
- * @returns {number} An unhandled value from an output call
|
|
|
+ * @returns {number|undefined} An unhandled value from an output call, or undefined if the array is empty
|
|
|
*/
|
|
|
FetchOutputValue() {
|
|
|
- return this.outputValues.shift();
|
|
|
+ return this.HasOutput() ? this.outputValues.shift() : undefined;
|
|
|
}
|
|
|
|
|
|
/**
|