Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions src/data-structures/linked-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,19 @@
if (!this.first || !this.first.next) {
return;
}
var current = this.first.next;
var prev = this.first;
var temp;
while (current) {
temp = current.next;
current.next = prev;
prev.prev = current;
prev = current;
current = temp;
}
this.first.next = null;
this.last.prev = null;
temp = this.first;
this.first = prev;
this.last = temp;
var current = this.first
var next

do {
next = current.next
current.next = current.prev
current.prev = next
current = next
} while (next)

var tmp = this.first
this.first = this.last
this.last = tmp
};

})(typeof window === 'undefined' ? module.exports : window);