return should be provided in register user controller
Author: Madhav8528Created Jan 5, 2025Updated Mar 9, 2025
In, register user controller we are checking for empty fields by taking values from req.body by using some() function but we did'nt use return inside the arrow function of some() method so it will always result false, we have to add a return in the arrow function to properly use some() method.
Before : if( [username, email, fullName, password].some((field)=>{ field?.trim()===""}) ){ throw new ApiError(400, "Please provide all the details") }
After : if( [username, email, fullName, password].some((field)=>{ return field?.trim()===""}) ){ throw new ApiError(400, "Please provide all the details") }
Source: hiteshchoudhary/chai-backend