doc-comments-ai icon indicating copy to clipboard operation
doc-comments-ai copied to clipboard

adding "export" to the beginning of every line in the block - javascript issue

Open Bubbalubagus opened this issue 8 months ago • 0 comments

This library was tested on a few pages and on one page on one method is placed a bunch of the word "export" before each line like so:

// Fetch attractions
export export /**
export  * Performs a POST request to fetch attractions and Google Places recommendations based on the destination data provided in the request body. 
export  * If the request method is not POST, it sets the Allow header to POST and returns a 405 status code.
export  * @param {Object} req - The request object containing the destination data
export  * @param {Object} res - The response object to send back the attractions and recommendations
export  * @returns {Object} - An object containing shuffled array of attractions and Google Places recommendations
export  */
export async function POST(req, res) {
export   if (req.method === "POST") {
export     const { destination } = await req.json();
export     const viatorActivities = await fetchAttractions(destination.id);
export     const googlePlaces = await getGooglePlacesRecommendations(`${destination.name} ${destination.timeZone}`);
export 
export     return Response.json({ data: _.shuffle([...viatorActivities, ...googlePlaces]) });
export   } else {
export     res.setHeader("Allow", ["POST"]);
export     res.status(405).end(`Method ${req.method} Not Allowed`);
export   }
export }

This is how it looked prior: `

// Fetch attractions
export async function POST(req, res) {
  if (req.method === "POST") {
    const { destination } = await req.json();
    const viatorActivities = await fetchAttractions(destination.id);
    const googlePlaces = await getGooglePlacesRecommendations(`${destination.name} ${destination.timeZone}`);

    return Response.json({ data: _.shuffle([...viatorActivities, ...googlePlaces]) });
  } else {
    res.setHeader("Allow", ["POST"]);
    res.status(405).end(`Method ${req.method} Not Allowed`);
  }
}

`

Bubbalubagus avatar May 28 '24 19:05 Bubbalubagus