Debug and refactor code with Cerewro

Pass buggy code to Cerewro and get the detected bug, root cause explained in plain language and fixed code. Also refactor complex functions, add TypeScript typing, improve performance and generate tests automatically.

Debug prompt
This JavaScript gives "TypeError: Cannot read properties of undefined (reading 'map')". Analyze the code, explain the cause and fix it: [paste code]
Callback hell → async/await (Cerewro)
// ❌ Before: nested callbacks
getUser(id, (err, user) => {
  if (err) return handleError(err);
  getOrders(user.id, (err, orders) => { ... });
});

// ✅ After: async/await
async function loadUserData(id) {
  try {
    const user     = await getUser(id);
    const orders   = await getOrders(user.id);
    renderPage(orders);
  } catch (err) {
    handleError(err);
  }
}
Generate Jest unit tests
Generate complete Jest tests for this function. Include: normal input, empty input, edge cases, wrong types and expected errors: [paste function]
Performance analysis: Ask Cerewro: "Analyze the performance of this code, identify bottlenecks and propose optimizations with Big O for each function". The AI compares complexity before and after optimization.