I have three functions structured in the following way:
const func = (arr) => {
var ch = {};
arr.map(ar => {
ar.stage_executions.map((s) => {
ch[s.stage.name] = [];
})
})
return ch;
}
const func2 = (arr) => {
var all = func(arr);
for(var k in all) {
arr.map((ar) => {
ar.stage_executions.map((st) => {
if (st.stage.name === k) {
all[k].push(st.stage.name, st.duration_millis)
}
})
})
}
return all;
}
const func3 = (arr) => {
const all = func2(arr);
for(var key in all) {
all[key] = [...new Set(all[key])]
}
return all;
}
console.log(func3(job_execs))
I want to convert these into functions into methods that look like the rest of my vue.js methods.
example:
func: function() {
return all
},
How do I do I convert my methods to look like the function above?