diff --git a/src/index.ts b/src/index.ts index 2023945715202daf6d3696442b79237f8050baab..203cc1b5b3a603ec68536b0a553d969c5abd5b1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -100,15 +100,16 @@ async function run(inputDir: string, outputDir: string, options: CliOptions) { const tOrder = { P: 0, F: 1, B: 2 }; 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. :) return ( - tOrder[b.type] - tOrder[a.type] - || getNum(b) - getNum(a) - || b.number.localeCompare(a.number) - ); // Invalid number format + tOrder[b.type] - tOrder[a.type] || getNum(b) - getNum(a) + ); }), }, }));