Skip to content

Commit

Permalink
early return
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaucasau committed Apr 3, 2024
1 parent 5b1c16d commit 7f67604
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions scripts/lib/api/mergeClassMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,30 @@ export async function mergeClassMembers(
.use(() => {
return async (root: Root) => {
// The attribute and method's section can be found under the class component
const mdxClassElement = root.children
.find(
(node): node is MdxJsxFlowElement =>
node.type == "mdxJsxFlowElement" && node.name == "Class",
);
const mdxClassElement = root.children.find(
(node): node is MdxJsxFlowElement =>
node.type == "mdxJsxFlowElement" && node.name == "Class",
);

if (!mdxClassElement) {
return;
}

for (const node of mdxClassElement?.children ?? []) {
for (const node of mdxClassElement.children) {
await replaceMembersAfterTitle(
mdxClassElement!,
mdxClassElement,
node,
"Attributes",
attributesAndProps,
);
await replaceMembersAfterTitle(
mdxClassElement!,
mdxClassElement,
node,
"Methods",
methods,
);
await replaceMembersAfterTitle(
mdxClassElement!,
mdxClassElement,
node,
"Methods Defined Here",
methods,
Expand Down

0 comments on commit 7f67604

Please sign in to comment.