This method finds an employee from a given mother company which consists of group of companies. An employee can work for many child company.
$scope.getEmployee = function(subsidiary, salaryScale){ //1
var workingDepartments = [];//2
var findInGroupOfCompanies = function(comGroup, salaryScale){//3
var salaryIndex = subsidiary[salaryScale];//4
if(salaryIndex != "SUPERIOR" && salaryIndex == comGroup.salaryIndex) {//5
if(comGroup.hasSubsidiaries()) { //6
findInGroupOfCompanies(comGroup, salaryScale++ ); //7
} else {//8
workingDepartments.push(comGroup);//8
//and do some stuff
}
}
};
The method findInGroupOfCompanies
and its function is separated by equal and intended. Is this formatting not adhering to general code styles in JS? Have I added spaces unnecessarily after line number 3?