Skip to content

Commit

Permalink
docs: account for multiple recommendation blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed May 5, 2022
1 parent c05c93f commit cf2c146
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docs/update-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ const props = [
.map((e) => parseInt(e.slice(-1), 10) || 0));
override = `example${i + 1}`;
}
if (prop === 'recommendation' && option.recommendation) {
const i = Math.max(...Object.keys(option)
.filter((p) => p.startsWith('recommendation'))
.map((e) => parseInt(e.slice(-1), 10) || 0));
override = `recommendation${i + 1}`;
}
option.active = override || prop;
option.write(line.slice(prop.length + 4));
return true;
Expand Down Expand Up @@ -253,10 +259,8 @@ const props = [
append(`${capitalizeSentences(section.description.join(' '))} \n\n`);
}

['recommendation'].forEach((option) => {
if (section[option]) {
append(`_**${option}**_: ${section[option].join(' ')} \n\n`);
}
Object.keys(section).filter((x) => x.startsWith('recommendation')).forEach((prop) => {
append(`_**recommendation**_: ${section[prop].join(' ')} \n\n`);
});

if (!('@nodefault' in section)) {
Expand Down

0 comments on commit cf2c146

Please sign in to comment.