From 0bd1d2b29141d76963ed65e4b8fde9a7bd838bee Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 16 Jul 2021 13:39:02 +0530 Subject: [PATCH] Improve code Signed-off-by: RMidhunSuresh --- src/platform/web/ui/general/LazyListView.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/platform/web/ui/general/LazyListView.js b/src/platform/web/ui/general/LazyListView.js index 08052dac..90adc49e 100644 --- a/src/platform/web/ui/general/LazyListView.js +++ b/src/platform/web/ui/general/LazyListView.js @@ -214,15 +214,9 @@ export class LazyListView extends ListView { } _removeAdditionalElement(fromIdx, toIdx) { - if (toIdx < fromIdx) { - // Element comes from the bottom, so remove element at bottom - const child = this._childInstances.pop(); - this._removeChild(child); - } - else { - const child = this._childInstances.shift(); - this._removeChild(child); - } + // If element comes from the bottom, remove element at bottom and vice versa + const child = toIdx < fromIdx ? this._childInstances.pop() : this._childInstances.shift(); + this._removeChild(child); } onMove(fromIdx, toIdx, value) {