Skip to content
Snippets Groups Projects
Commit e87f9452 authored by Thabo Bals's avatar Thabo Bals
Browse files

fix ordering

parent e85dd770
No related branches found
No related tags found
1 merge request!112Resolve "Numerische sortierung sollte passieren..."
Pipeline #284469 passed
...@@ -100,15 +100,16 @@ async function run(inputDir: string, outputDir: string, options: CliOptions) { ...@@ -100,15 +100,16 @@ async function run(inputDir: string, outputDir: string, options: CliOptions) {
const tOrder = { P: 0, F: 1, B: 2 }; const tOrder = { P: 0, F: 1, B: 2 };
function getNum(x: Resolution) { function getNum(x: Resolution) {
return parseInt(x.number.match(/^\d+/)?.[0], 10); return parseInt(
x.number.match(/\.(\d+)[PFB]?$/)?.[1],
10,
);
} }
// This works because `0` and `NaN` are falsy. :) // This works because `0` and `NaN` are falsy. :)
return ( return (
tOrder[b.type] - tOrder[a.type] tOrder[b.type] - tOrder[a.type] || getNum(b) - getNum(a)
|| getNum(b) - getNum(a) );
|| b.number.localeCompare(a.number)
); // Invalid number format
}), }),
}, },
})); }));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment