summaryrefslogtreecommitdiff
path: root/blocks/eda-frontend/src/utils/Queue.js
blob: 7f960819076592ec902c16a625e5c9f3bac93fe9 (plain)
1
2
3
/* eslint-disable */
// code.stephenmorley.org
export function Queue(){let a=[],b=0;this.getLength=function(){return a.length-b};this.isEmpty=function(){return 0===a.length};this.enqueue=function(b){a.push(b)};this.dequeue=function(){if(0!==a.length){const c=a[b];if(2*(++b)>=a.length){a=a.slice(b);b=0};return c}};this.peek=function(){return 0<a.length?a[b]:void 0}}