I'm working with ES6 and React. I'm parsing through a response object from a Java Rest service, and it dawned on me that there's probably a cleaner way of doing parsing an object into two objects. This wokrs, it just looks clunky.
let draftList = [];
let readyForApprovalList = [];
for (let i = 0; i < action.allStatusesSurveysList.length; i++){
if (action.allStatusesSurveysList[i].status === statusTypes.DRAFT){
draftList.push(action.allStatusesSurveysList[i]);
} else if (action.allStatusesSurveysList[i].status === statusTypes.READY_FOR_APPROVAL){
readyForApprovalList.push(action.allStatusesSurveysList[i]);
}
}