Skip to content

Commit 371f10b

Browse files
committed
Nested ternary unfolding
1 parent cd79c7f commit 371f10b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/controllers/controller.radar.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ defaults._set('radar', {
2222
});
2323

2424
function nextItem(collection, index, loop) {
25-
return index >= collection.length - 1
26-
? loop ? collection[0] : collection[index]
27-
: collection[index + 1];
25+
if (index >= collection.length - 1) {
26+
return loop ? collection[0] : collection[index];
27+
}
28+
return collection[index + 1];
2829
}
2930

3031
function previousItem(collection, index, loop) {
31-
return index <= 0
32-
? loop ? collection[collection.length - 1] : collection[index]
33-
: collection[index - 1];
32+
if (index <= 0) {
33+
return loop ? collection[collection.length - 1] : collection[index];
34+
}
35+
return collection[index - 1];
3436
}
3537

3638
module.exports = DatasetController.extend({

0 commit comments

Comments
 (0)