Choose existing utilities, simpler patterns, and cleaner implementations over manual or complex approaches. This improves code maintainability and reduces potential bugs.

Key practices:

Example of preferred approach:

// Instead of manual parsing:
const cookies = cookieString.split(";").map(cookie => cookie.trim());

// Use existing utility:
const cookieValue = ctx.getCookie(cookieName);

// Instead of else-if chains:
if (authentication === "basic") {
    requestHeaders["authorization"] = `Basic ${encodedCredentials}`;
}
if (authentication !== "basic" && options.clientSecret) {
    body.set("client_secret", options.clientSecret);
}

This approach reduces complexity, leverages tested utilities, and makes code more readable and maintainable.