Skip to content

Commit

Permalink
Skip parent if they do not have local name instead of throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinovantes committed Jul 3, 2024
1 parent a2b564e commit a8f574b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Plugins/Domains/Js/getJsLocalName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
*
* For `$.getJSON(href, callback[, errback])`, this function returns `getJSON`
*/
export function getJsLocalName(fullName: string): string {
const localName = /(?<jsName>[a-zA-Z][\w.]+)\(?/.exec(fullName)?.groups?.jsName
if (!localName) {
throw new Error(`Failed to getJsLocalName fullName:"${fullName}"`)
}

return localName
export function getJsLocalName(fullName: string): string | null {
return /(?<jsName>[a-zA-Z][\w.]+)\(?/.exec(fullName)?.groups?.jsName ?? null
}
4 changes: 4 additions & 0 deletions src/Plugins/Domains/Js/getParentModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export function getParentModules(node: RstDirective): Array<string> {
}

const localName = getJsLocalName(parent.initContentText)
if (!localName) {
continue
}

nameChain.unshift(localName)
}

Expand Down

0 comments on commit a8f574b

Please sign in to comment.