-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Retrieve `dimensionNames` used for sorting. | ||
// - Instead of using lexicographic order, we use the order of dimensions as | ||
// specified by the user in the `system` configuration property | ||
// - This is persisted in results and we ensure it does not change until it | ||
// reaches this logic | ||
// - We use the most recent results in priority | ||
export const getDimensionNames = function (firstSystem, systems) { | ||
const firstDimensionNames = getSystemDimensionNames(firstSystem) | ||
const uniqueDimensionNames = [ | ||
...new Set(systems.flatMap(getSystemDimensionNames)), | ||
] | ||
const otherDimensionNames = uniqueDimensionNames.filter( | ||
(dimensionName) => !firstDimensionNames.includes(dimensionName), | ||
) | ||
return [...firstDimensionNames, ...otherDimensionNames] | ||
} | ||
|
||
const getSystemDimensionNames = function ({ dimensions }) { | ||
return Object.keys(dimensions) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters