summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2016-06-30 13:55:28 -0400
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-06-30 13:55:28 -0400
commit81e002d132a3ca99f42040d5cd3e184172aeb624 (patch)
treee2bde82d07d28fc440da8b0c289266f59ddeddf4
parent592f95cf1c90d71dfdb68f4e4c9ca0cdd30a91bc (diff)
downloadasync-dll.tar.gz
Minor cleanupdll
-rw-r--r--lib/internal/DoublyLinkedList.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/internal/DoublyLinkedList.js b/lib/internal/DoublyLinkedList.js
index ae46957..79c3bb5 100644
--- a/lib/internal/DoublyLinkedList.js
+++ b/lib/internal/DoublyLinkedList.js
@@ -13,7 +13,6 @@ function setInitial(dll, node) {
}
DLL.prototype.removeLink = function(node) {
- if (!node) return node;
if (node.prev) node.prev.next = node.next;
else this.head = node.next
if (node.next) node.next.prev = node.prev;
@@ -54,11 +53,10 @@ DLL.prototype.push = function(node) {
else setInitial(this, node);
};
-
DLL.prototype.shift = function() {
- return this.removeLink(this.head);
+ return this.head && this.removeLink(this.head);
};
DLL.prototype.pop = function() {
- return this.removeLink(this.tail);
+ return this.tail && this.removeLink(this.tail);
};