From 90dec66baa7c71fcacb53426a77213c4f8dd710a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 24 Feb 2024 12:25:23 -0400 Subject: data: withSortedList: refactor unstableSortIndices magic It's still magic though. --- src/data/composite/data/withSortedList.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/data') 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, -- cgit 1.3.0-6-gf8a5