« get me outta code hell

data: withSortedList: refactor unstableSortIndices magic - 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:
author(quasar) nebula <qznebula@protonmail.com>2024-02-24 12:25:23 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-02-24 13:35:52 -0400
commit90dec66baa7c71fcacb53426a77213c4f8dd710a (patch)
tree6650a8023d0f9088735d68af20cafebd68398628 /src/data/composite
parent80ca33f781b710074b11ed68eae6fc2ec314ea84 (diff)
data: withSortedList: refactor unstableSortIndices magic
It's still magic though.
Diffstat (limited to 'src/data/composite')
-rw-r--r--src/data/composite/data/withSortedList.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/data/composite/data/withSortedList.js b/src/data/composite/data/withSortedList.js
index 3a069cf7..1d9188f8 100644
--- a/src/data/composite/data/withSortedList.js
+++ b/src/data/composite/data/withSortedList.js
@@ -122,10 +122,10 @@ export default templateCompositeFrom({
             }, [0]);
 
         const unstableSortIndices =
-          Array.from(
-            {length: list.length},
-            (_, index) =>
-              stableToUnstable[symbols.indexOf(indexToSymbol.get(index))]);
+          Array.from({length: list.length}, (_, index) => index)
+            .map(index => indexToSymbol.get(index))
+            .map(symbol => symbols.indexOf(symbol))
+            .map(stable => stableToUnstable[stable]);
 
         return continuation({
           ['#sortedList']: sortedList,