Skip to content
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

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

Open
Bubbalubagus opened this issue May 28, 2024 · 0 comments

Comments

@Bubbalubagus
Copy link

Bubbalubagus commented May 28, 2024

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`);
  }
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant