source: node_modules/core-js-pure/internals/queue.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 500 bytes
Line 
1'use strict';
2var Queue = function () {
3 this.head = null;
4 this.tail = null;
5};
6
7Queue.prototype = {
8 add: function (item) {
9 var entry = { item: item, next: null };
10 var tail = this.tail;
11 if (tail) tail.next = entry;
12 else this.head = entry;
13 this.tail = entry;
14 },
15 get: function () {
16 var entry = this.head;
17 if (entry) {
18 var next = this.head = entry.next;
19 if (next === null) this.tail = null;
20 return entry.item;
21 }
22 }
23};
24
25module.exports = Queue;
Note: See TracBrowser for help on using the repository browser.