-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use early returns for sphinxHtmlToMarkdown member processing #590
Use early returns for sphinxHtmlToMarkdown member processing #590
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Big improvement IMO, I find the new code much easier to read 🚀
If you haven't already, can you regenerate the current API docs to check they stay the same?
} | ||
|
||
return `<div>${$child.html()}</div>`; | ||
throw new Error(`Unhandled Python type: ${python_type}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
This PR is a follow-up from #584. None of the logic is changed, only the control flow. This uses early returns to make it more clear how each distinct API type is handled. It also DRYs this code: ```typescript const priorPythonApiType = meta.python_api_type; if (!priorPythonApiType) { meta.python_api_type = python_type; meta.python_api_name = id; } ``` --------- Co-authored-by: Eric Arellano <[email protected]>
) This PR is a follow-up from Qiskit#584. None of the logic is changed, only the control flow. This uses early returns to make it more clear how each distinct API type is handled. It also DRYs this code: ```typescript const priorPythonApiType = meta.python_api_type; if (!priorPythonApiType) { meta.python_api_type = python_type; meta.python_api_name = id; } ``` --------- Co-authored-by: Eric Arellano <[email protected]>
This PR is a follow-up from #584.
None of the logic is changed, only the control flow. This uses early returns to make it more clear how each distinct API type is handled. It also DRYs this code: