Skip to content

Commit 81107e8

Browse files
📚 docs: Improve docstrings.
1 parent a8f9e08 commit 81107e8

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/_iter.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import assert from 'assert';
22
import Node from './Node.js';
33

44
/**
5-
* Generator of nodes in list in order.
5+
* Generator of nodes in list in order. You are allowed to edit the current
6+
* node.
67
*
7-
* TODO yield values/keys instead?
8+
* /!\ Modifying the next pointer of the current node will NOT change which
9+
* node comes next in the iteration.
810
*
911
* @param {Node} first First node of the list.
10-
* @return {IterableIterator} Yields nodes of a list in order.
12+
* @return {IterableIterator<Node>} Yields nodes of a list in order.
1113
*/
1214
export default function* _iter(first) {
1315
assert(first instanceof Node);

src/iter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Node from './Node.js';
66
* Generator of nodes in list in order.
77
*
88
* @param {Node} first First node of the list (can be null).
9-
* @return {IterableIterator}
9+
* @return {IterableIterator<Node>}
1010
*/
1111
export default function* iter(first) {
1212
assert(first === null || first instanceof Node);

src/pop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import _remove from './_remove.js';
66
* Removes last {@link Node} from a list. Throws if input list is empty.
77
*
88
* @param {Node} x First node.
9-
* @return {[Node, Node]} New list (possibly null) and popped node.
9+
* @return {[Node, Node]} New list (possibly null) and removed node.
1010
*/
1111
export default function pop(x) {
1212
if (x === null) throw new Error('input list is empty');

src/shift.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ import _remove from './_remove.js';
55
/**
66
* Removes first {@link Node} from a list. Throws if input list is empty.
77
*
8-
* TODO I do not think we need to return the popped node since it is x.
9-
* Currently this is kept so to have the same signature as {@link pop}.
10-
*
118
* @param {Node} x First node .
12-
* @return {[Node, Node]} New list (possibly null) and popped node.
9+
* @return {[Node, Node]} New list (possibly null) and removed node.
1310
*/
1411
export default function shift(x) {
1512
if (x === null) throw new Error('input list is empty');

0 commit comments

Comments
 (0)