/*! * stack-adt * v0.2.3 - 2014-08-03 * https://github.com/pasangsherpa/stack-adt * (c) Pasang Sherpa (https://github.com/pasangsherpa) * MIT License */ !function(){"use strict";var a=function(a){function b(a){if(f()===i)throw new Error("push(): Stack is full.");return j.push(a)}function c(){if(e())throw new Error("pop(): Stack is empty.");return j.pop()}function d(){if(e())throw new Error("peek(): Stack is empty.");return j[j.length-1]}function e(){return 0===f()}function f(){return j.length}function g(){for(;j.length;)j.pop()}function h(){function a(){return j.length!==c}function b(){if(!a())throw new Error("next(): No such element.");return j[j.length-1-c++]}var c=0;return{hasNext:a,next:b}}var i=a||1/0,j=[];return{push:b,pop:c,peek:d,isEmpty:e,size:f,empty:g,iterator:new h}};"function"==typeof define&&define.amd?define(function(){return a}):"undefined"!=typeof module&&module.exports?module.exports=a:window.Stack=a}();