Skip to content

Commit

Permalink
Fix lint issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
trekhleb committed Jan 26, 2022
1 parent 2a49b70 commit 9ca459f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/data-structures/linked-list/LinkedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9ca459f

Please sign in to comment.