source: imaps-frontend/node_modules/core-js/internals/queue.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • 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.