Browse Source

Update Stack.prototype.Push

Updated to allow for pushing of arrays. The explodes the array ensuring
the stack remains flat.
ApisNecros 1 year ago
parent
commit
8bdd7821b7
1 changed files with 6 additions and 1 deletions
  1. 6 1
      starfish.js

+ 6 - 1
starfish.js

@@ -733,7 +733,12 @@ class Stack {
      * @param {*} newValue 
      * @param {*} newValue 
      */
      */
     Push(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
      * Wrapper function for Array.prototype.pop