Skip to content

Instantly share code, notes, and snippets.

@cjkoepke
Created April 18, 2018 15:40
Show Gist options
  • Save cjkoepke/c4388348f1ae4f63d424e737dcfbaeab to your computer and use it in GitHub Desktop.
Save cjkoepke/c4388348f1ae4f63d424e737dcfbaeab to your computer and use it in GitHub Desktop.
shouldShow = groups => {
const field = this.props.field
let show = true
if ( field.conditional_logic ) {
field.conditional_logic.forEach( conditions => {
conditions.forEach( condition => {
const { field } = fieldLookup( groups, condition.field )
if ( field ) {
if ( eval( `"${field.value}" !${condition.operator} "${condition.value}"` ) ) {
show = false
}
}
} )
} )
}
return show
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment