Created
March 22, 2024 03:53
-
-
Save koladilip/133eda490bb50eedfe7bdeaabae8b933 to your computer and use it in GitHub Desktop.
Extracts Employee Names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(___d) { | |
let ___r; | |
let ___1; | |
let ___2; | |
let ___3; | |
let ___4; | |
let ___5; | |
let ___6; | |
let ___7; | |
let ___8; | |
let ___9; | |
let ___10; | |
___r = ___d; | |
___7=[]; | |
___1=___r; | |
if(___1 !== null && ___1 !== undefined){___1 = Array.isArray(___1) ? ___1 : [___1]; | |
}for(___3=0; | |
___3<___1.length; | |
___3++) {___5 = ___1[___3]; | |
if(___5 && Object.prototype.hasOwnProperty.call(___5, 'employees')){___5=___5['employees']; | |
} else {___5 = undefined; | |
}if(___5 === null || ___5 === undefined) { continue; | |
}___2=___5; | |
if(___2 !== null && ___2 !== undefined){___2 = Array.isArray(___2) ? ___2 : [___2]; | |
}for(___4=0; | |
___4<___2.length; | |
___4++) {___6 = ___2[___4]; | |
___10=[]; | |
___8=[___6]; | |
while(___8.length > 0) {___9 = ___8.shift(); | |
if(___9 === null || ___9 === undefined){continue; | |
}if(Array.isArray(___9)){___8 = ___8.concat(___9); | |
continue; | |
}if(typeof ___9 === "object") {___8 = ___8.concat(Object.values(___9).filter(v => v !== null && v !== undefined)); | |
if(Object.prototype.hasOwnProperty.call(___9, 'name')){___10 = ___10.concat(___9['name']); | |
}}}___6 = ___10.flat(); | |
if(___6 === null || ___6 === undefined) { continue; | |
}___7.push(___6); | |
}}___7 = ___7.length < 2 ? ___7[0] : ___7; | |
___r=___7; | |
return ___r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment