Skip to content

Commit

Permalink
chore: reword function definition
Browse files Browse the repository at this point in the history
chore: reword function definition
  • Loading branch information
GalacticHypernova authored Jan 24, 2024
2 parents 1f936ea + 5efcb74 commit 3778ed5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { resolve } from "pathe";
export const files = new Map<string, string>();

/**
* A utility for extracting the JSDoc annotations from a function in the given module, if it exists.
* A utility for extracting the JSDoc annotations from a member in the given module, if it exists.
@param modulePath - The path to the module containing the function.
@param functionName - The name of the function to extract the JSDoc annotations from.
@param member - The name of the member to extract the JSDoc annotations from.
@returns The JSDoc annotations for the given function, if it exists.
@throws {Error} if something went wrong
*/
export function extractJSDoc(modulePath: string, functionName: string) {
export function extractJSDoc(modulePath: string, member: string) {
try {
const jsDocRE = new RegExp(
`(\\/\\*\\*[\\s\\S]*\\*\\/)\\s*(?:\n[^\\n]*${functionName})`,
`(\\/\\*\\*[\\s\\S]*\\*\\/)\\s*(?:\n[^\\n]*${member})`,
"i",
);
modulePath = resolve(modulePath.replaceAll("../", ""));
Expand Down

0 comments on commit 3778ed5

Please sign in to comment.