Skip to content

Commit

Permalink
Update list.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitPaul0007 authored Sep 10, 2023
1 parent 215449a commit cd903f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/data/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

class List {
constructor() {
var sentinel = {};
let sentinel = {};
sentinel._next = sentinel._prev = sentinel;
this._sentinel = sentinel;
}

dequeue() {
var sentinel = this._sentinel;
var entry = sentinel._prev;
let sentinel = this._sentinel;
let entry = sentinel._prev;
if (entry !== sentinel) {
unlink(entry);
return entry;
}
}

enqueue(entry) {
var sentinel = this._sentinel;
let sentinel = this._sentinel;
if (entry._prev && entry._next) {
unlink(entry);
}
Expand All @@ -31,9 +31,9 @@ class List {
}

toString() {
var strs = [];
var sentinel = this._sentinel;
var curr = sentinel._prev;
let strs = [];
let sentinel = this._sentinel;
let curr = sentinel._prev;
while (curr !== sentinel) {
strs.push(JSON.stringify(curr, filterOutLinks));
curr = curr._prev;
Expand Down

0 comments on commit cd903f7

Please sign in to comment.