Skip to content

Commit 9ca459f

Browse files
committedJan 26, 2022
Fix lint issue.
1 parent 2a49b70 commit 9ca459f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎src/data-structures/linked-list/LinkedList.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export default class LinkedList {
5656

5757
/**
5858
* @param {*} value
59-
* @param {*} index
59+
* @param {number} index
6060
* @return {LinkedList}
6161
*/
62-
insert(value, index) {
63-
index = index < 0 ? 0 : index;
62+
insert(value, rawIndex) {
63+
const index = rawIndex < 0 ? 0 : rawIndex;
6464
if (index === 0) {
6565
this.prepend(value);
6666
} else {
@@ -70,7 +70,7 @@ export default class LinkedList {
7070
while (currentNode) {
7171
if (count === index) break;
7272
currentNode = currentNode.next;
73-
count++;
73+
count += 1;
7474
}
7575
if (currentNode) {
7676
newNode.next = currentNode.next;

‎src/data-structures/linked-list/__test__/LinkedList.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('LinkedList', () => {
4545
linkedList.insert(10, 9);
4646

4747
expect(linkedList.toString()).toBe('1,4,2,3,10');
48-
})
48+
});
4949

5050
it('should delete node by value from linked list', () => {
5151
const linkedList = new LinkedList();

0 commit comments

Comments
 (0)
Please sign in to comment.