From 3cd412ae02d632c83324f220fe02f0a97ca93e89 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 7 May 2020 16:41:26 +0200 Subject: [PATCH] REFACTOR: removes useless variable assignment (#9666) --- .../select-kit/components/select-kit.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/select-kit/components/select-kit.js b/app/assets/javascripts/select-kit/components/select-kit.js index 71cf24e5764..74544c91f1e 100644 --- a/app/assets/javascripts/select-kit/components/select-kit.js +++ b/app/assets/javascripts/select-kit/components/select-kit.js @@ -641,19 +641,18 @@ export default Component.extend( }, _highlightNext() { - const highlightedIndex = this.mainCollection.indexOf( + let highlightedIndex = this.mainCollection.indexOf( this.selectKit.highlighted ); - let newHighlightedIndex = highlightedIndex; const count = this.mainCollection.length; if (highlightedIndex < count - 1) { - newHighlightedIndex = highlightedIndex + 1; + highlightedIndex = highlightedIndex + 1; } else { - newHighlightedIndex = 0; + highlightedIndex = 0; } - const highlighted = this.mainCollection.objectAt(newHighlightedIndex); + const highlighted = this.mainCollection.objectAt(highlightedIndex); if (highlighted) { this._scrollToRow(highlighted); this.set("selectKit.highlighted", highlighted); @@ -661,19 +660,18 @@ export default Component.extend( }, _highlightPrevious() { - const highlightedIndex = this.mainCollection.indexOf( + let highlightedIndex = this.mainCollection.indexOf( this.selectKit.highlighted ); - let newHighlightedIndex = highlightedIndex; const count = this.mainCollection.length; if (highlightedIndex > 0) { - newHighlightedIndex = highlightedIndex - 1; + highlightedIndex = highlightedIndex - 1; } else { - newHighlightedIndex = count - 1; + highlightedIndex = count - 1; } - const highlighted = this.mainCollection.objectAt(newHighlightedIndex); + const highlighted = this.mainCollection.objectAt(highlightedIndex); if (highlighted) { this._scrollToRow(highlighted); this.set("selectKit.highlighted", highlighted);