Quellcode durchsuchen

Change Get to GetAtIndex

ApisNecros vor 1 Jahr
Ursprung
Commit
4569ccf491
1 geänderte Dateien mit 5 neuen und 8 gelöschten Zeilen
  1. 5 8
      IntComp/Stack.js

+ 5 - 8
IntComp/Stack.js

@@ -27,16 +27,13 @@ module.exports = class Stack {
     }
 
     /**
-     * Get a value from the stack
+     * Get a value at a given index on the stack
      *
-     * If an index isn't given, retrieves the value at the current
-     * location of the pointer
-     *
-     * @param {?number} index The index of the value to retrieve
-     * @returns {number} The value at the given index, or 0
+     * @param {number} index The index of the value to retrieve
+     * @returns {number} The value at the given index, or 0 if the index hasn't been defined yet
      */
-    Get(index = null) {
-        if (index !== null && (Number.isNaN(index) || !Number.isInteger(index))) {
+    GetAtIndex(index) {
+        if (index == null || Number.isNaN(index) || !Number.isInteger(index)) {
             throw new TypeError("index must be an integer");
         }