Skip to content

Commit

Permalink
Fix: circularValues() method
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Jan 19, 2019
1 parent b922f2d commit 727acec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,15 @@ class CircularDoublyLinkedList {
* allows execution to stop and not pick up again until the iterator's
* `next()` method is called again.
*
* It's possible for this loop to exit if the list is emptied
* in between calls to the iterator's `next()` method. That will
* cause `current` to be `null` and the iterator will close.
* It's not possible for this loop to exit. Even removing all nodes
* from the list using `remove()` or `clear()` will not cause the
* loop to stop yield values. That's because `current.next` always
* has a value, even if it just points back to `current`.
*/
do {
yield current.data;
current = current.next;
} while (current !== null);
} while (true);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@humanwhocodes/circular-doubly-linked-list",
"version": "2.0.1",
"version": "2.0.2",
"description": "A circular doubly linked list implementation in JavaScript",
"main": "circular-doubly-linked-list.js",
"scripts": {
Expand Down

0 comments on commit 727acec

Please sign in to comment.