JSFiddle - React, Tailwind, and code Playground
by ryanbrill
JavaScript
var list = [];
var output = [
"Adam Brill",
"Ahmed Rezk",
"Andrew Owen",
"Anthony Pileggi",
"Carrie Mueller",
"Charles Triponez",
"Chris Lees",
"Connie Dowdle",
"Daniel Andresen",
"Jeff Hand",
"Julie Tanis",
"Justin Myers\n Contractor",
"Justin Rodriguez",
"Katelyn Dallmann",
"Kevin Whitaker\n Contractor",
"Mary Kate Maltzan",
"Matthew Tanis",
"Principle Accounting",
"Ruud Erie\n Contractor",
"Ryan Brill",
"Seth O'Harra\n Contractor",
"Stephen Montana",
"Timothy Stepp\n Contractor",
"Zebadiah Cockrell"
];
for(var i=0; i<output.length; i++) {
let person = output[i];
let isEmployee = true;
let item = {};
//console.log(person);
if (person.match("Contractor")) {
isEmployee = false;
}
person = person.replace(/\n\s*/, '');
person = person.replace('Contractor', '');
if (person != 'Principle Accounting') {
item.name = person;
item.type = (isEmployee) ? 'Employee' : 'Contractor';
list.push(item)
}
}
console.log(list);