Skip to content

Instantly share code, notes, and snippets.

@disgusting-dev
Last active April 4, 2021 09:36
Show Gist options
  • Save disgusting-dev/09005774327714f64ba8d075efe9020b to your computer and use it in GitHub Desktop.
Save disgusting-dev/09005774327714f64ba8d075efe9020b to your computer and use it in GitHub Desktop.
const ignoringConditions = [
() => false,
() => false,
() => false,
]
const hiringConditions = [
() => true,
() => false,
() => false,
]
const mbConditions = [
() => false,
() => false,
() => false,
]
const conditionsEnum = {
nope: ignoringConditions,
hire: hiringConditions,
maybe: mbConditions,
}
let result = '';
for (let field in conditionsEnum) {
if (conditionsEnum[field].some(condition => !!condition())) {
result = field;
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment