We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
yarn flags --sort flag
1 parent 2e470a7 commit acaae63Copy full SHA for acaae63
scripts/flags/flags.js
@@ -318,11 +318,15 @@ for (const flag of allFlagsUniqueFlags) {
318
let sorted = table;
319
if (isDiff || argv.sort) {
320
const sortChannel = argToHeader(isDiff ? argv.diff[0] : argv.sort);
321
- sorted = Object.fromEntries(
322
- Object.entries(table).sort(([, rowA], [, rowB]) =>
323
- rowB[sortChannel].toString().localeCompare(rowA[sortChannel])
324
- )
325
- );
+ const sortBy =
+ sortChannel === 'flag'
+ ? ([flagA], [flagB]) => {
+ return flagA.localeCompare(flagB);
+ }
326
+ : ([, rowA], [, rowB]) => {
327
+ return rowB[sortChannel].toString().localeCompare(rowA[sortChannel]);
328
+ };
329
+ sorted = Object.fromEntries(Object.entries(table).sort(sortBy));
330
}
331
332
if (argv.csv) {
0 commit comments