Skip to content

Commit

Permalink
chore(scripts/reorder-search-index): refine comments
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner authored Dec 9, 2024
1 parent 7acae53 commit aec80a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/reorder-search-index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ async function main() {

const result = [];

// Add all reference items that are in the reference.
// Add entry for each reference item.
for (const [refIndex, slug] of refSlugs.entries()) {
const inputIndex = inputSlugs.indexOf(slug);
// Use reference item where index does not have this item.
// Use reference item if it's currently missing in index.
const item = inputIndex !== -1 ? input[inputIndex] : ref[refIndex];
result.push(item);
}

// Add items that are NOT in the reference (e.g. moved/removed).
// Add entry for any item that is NOT in the reference (e.g. moved/removed).
for (const [inputIndex, slug] of inputSlugs.entries()) {
if (!refSlugs.includes(slug)) {
const item = input[inputIndex];
Expand Down

0 comments on commit aec80a6

Please sign in to comment.