Skip to content

Extract duplicated link transformation logic into helper function#7660

Merged
mdong1909 merged 2 commits into12-26-docs_auto-genfrom
copilot/sub-pr-7659
Dec 25, 2025
Merged

Extract duplicated link transformation logic into helper function#7660
mdong1909 merged 2 commits into12-26-docs_auto-genfrom
copilot/sub-pr-7659

Conversation

Copy link
Contributor

Copilot AI commented Dec 25, 2025

Addresses code review feedback to eliminate duplicated link transformation logic in api.data.ts.

Changes

  • Added transformLink() helper function to encapsulate the link transformation pattern
  • Replaced three instances of inline '/reference' + item.link.replace('.md', '') with the helper

Before:

items: inputOptions.map((item) => ({
  ...item,
  link: '/reference' + item.link.replace('.md', ''),
}))

After:

function transformLink(link: string): string {
  return '/reference' + link.replace('.md', '');
}

items: inputOptions.map((item) => ({
  ...item,
  link: transformLink(item.link),
}))

This reduces duplication and centralizes the transformation logic for easier maintenance.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update reference index page documentation based on feedback Extract duplicated link transformation logic into helper function Dec 25, 2025
Copilot AI requested a review from mdong1909 December 25, 2025 22:57
@mdong1909 mdong1909 marked this pull request as ready for review December 25, 2025 23:01
@mdong1909 mdong1909 merged commit 1cfb8e8 into 12-26-docs_auto-gen Dec 25, 2025
2 checks passed
@mdong1909 mdong1909 deleted the copilot/sub-pr-7659 branch December 25, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments