diff options
author | Graeme Yeates <yeatesgraeme@gmail.com> | 2016-06-30 13:55:28 -0400 |
---|---|---|
committer | Graeme Yeates <yeatesgraeme@gmail.com> | 2016-06-30 13:55:28 -0400 |
commit | 81e002d132a3ca99f42040d5cd3e184172aeb624 (patch) | |
tree | e2bde82d07d28fc440da8b0c289266f59ddeddf4 | |
parent | 592f95cf1c90d71dfdb68f4e4c9ca0cdd30a91bc (diff) | |
download | async-81e002d132a3ca99f42040d5cd3e184172aeb624.tar.gz |
Minor cleanupdll
-rw-r--r-- | lib/internal/DoublyLinkedList.js | 6 |
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); }; |