« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite')
-rw-r--r--src/data/composite/data/withSortedList.js22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/data/composite/data/withSortedList.js b/src/data/composite/data/withSortedList.js
index 51309e19..9ee0766b 100644
--- a/src/data/composite/data/withSortedList.js
+++ b/src/data/composite/data/withSortedList.js
@@ -107,20 +107,14 @@ export default templateCompositeFrom({
         };
 
         const stableToUnstable =
-          symbols
-            .map(
-              (current, index) =>
-                (index === 0
-                  ? false
-                  : isEqual(current, symbols[index - 1])))
-            .reduce(
-              (accumulator, equalsPrevious, index) =>
-                (index === 0
-                  ? accumulator
-                  : (equalsPrevious
-                      ? push(accumulator, accumulator.at(-1))
-                      : push(accumulator, accumulator.at(-1) + 1))),
-              [0]);
+          symbols.reduce(
+            (accumulator, current, index) =>
+              (index === 0
+                ? push(accumulator, 0)
+                : (isEqual(current, symbols[index - 1])
+                    ? push(accumulator, accumulator.at(-1))
+                    : push(accumulator, accumulator.at(-1) + 1))),
+            []);
 
         const unstableSortIndices =
           originalIndices