From 9ca459ff657318de2d5a86f2c56b8442db8b297f Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Wed, 26 Jan 2022 20:50:39 +0100 Subject: [PATCH] Fix lint issue. --- src/data-structures/linked-list/LinkedList.js | 8 ++++---- .../linked-list/__test__/LinkedList.test.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/data-structures/linked-list/LinkedList.js b/src/data-structures/linked-list/LinkedList.js index 310af779..ba7d0e3e 100644 --- a/src/data-structures/linked-list/LinkedList.js +++ b/src/data-structures/linked-list/LinkedList.js @@ -56,11 +56,11 @@ export default class LinkedList { /** * @param {*} value - * @param {*} index + * @param {number} index * @return {LinkedList} */ - insert(value, index) { - index = index < 0 ? 0 : index; + insert(value, rawIndex) { + const index = rawIndex < 0 ? 0 : rawIndex; if (index === 0) { this.prepend(value); } else { @@ -70,7 +70,7 @@ export default class LinkedList { while (currentNode) { if (count === index) break; currentNode = currentNode.next; - count++; + count += 1; } if (currentNode) { newNode.next = currentNode.next; diff --git a/src/data-structures/linked-list/__test__/LinkedList.test.js b/src/data-structures/linked-list/__test__/LinkedList.test.js index cc9440f1..fc534c26 100644 --- a/src/data-structures/linked-list/__test__/LinkedList.test.js +++ b/src/data-structures/linked-list/__test__/LinkedList.test.js @@ -45,7 +45,7 @@ describe('LinkedList', () => { linkedList.insert(10, 9); expect(linkedList.toString()).toBe('1,4,2,3,10'); - }) + }); it('should delete node by value from linked list', () => { const linkedList = new LinkedList();