Sfoglia il codice sorgente

Update Stack.prototype.Push

Updated to allow for pushing of arrays. The explodes the array ensuring
the stack remains flat.
ApisNecros 1 anno fa
parent
commit
8bdd7821b7
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      starfish.js

+ 6 - 1
starfish.js

@@ -733,7 +733,12 @@ class Stack {
      * @param {*} newValue 
      */
     Push(newValue) {
-        this.stack.push(newValue);
+        if(Array.isArray(newValue)) {
+            this.stack.push(...newValue);
+        }
+        else {
+            this.stack.push(newValue);
+        }
     }
     /**
      * Wrapper function for Array.prototype.pop