Homeyscript and lodash

I am trying to use lodash. But i am stuck how to rewrite a bit of my script. is someone willing to show me how to rewrite this peace of code.? That way hopefully i can sorten out the rest.

var count = 0;
var number = 0;

while(count <= sort.length -1)
{
var sortDay = global.get(sort[count] +'Day'+currentYear +currentMonth);//huidige dag opslaan
if(!Array.isArray(sortDay) || !sortDay.length)//als array niet bestaat
{
sortDay = Array(daysInCurrentMonth).fill(0);
sortDay.splice(currentDay -1,1,+eval(sortDay));
global.set(sort[count] +'Day' +currentYear +currentMonth, sortDay);
var sortDay = global.get(sort[count] +'Day'+currentYear +currentMonth);//huidige dag opslaan
console.log((number +1) +' ' +sort[count] +'Day' +currentYear +currentMonth +' is ' +sortDay);
}
console.log((number +2) +' '+sort[count] +'Day is: '+eval(sortDay));
sortDay.splice(currentDay -1,1,eval(sort[count]));
console.log((number +3) +' '+sort[count] +'Day' +' is: '+eval(sort[count]));
global.set(sort[count] +'Day' +currentYear +currentMonth, sortDay);
console.log((number +4) +' ' +sort[count] +'Day' +currentYear +currentMonth +' is ' +sortDay);
sortDay = global.get(sort[count] +'Day' +currentYear +currentMonth);
console.log((number +5) +' ' +sort[count] +'Day' +currentYear +currentMonth +' is ' +sortDay);
sortDay = sortDay[currentDay -1];
}

Can you also share sort?

sort = [‘water’, ‘gas’, ‘peak’, ‘offPeak’, ‘producedPeak’, ‘producedOffPeak’, ‘power’]