#Adding conditional operators to inline guards ?

1 messages · Page 1 of 1 (latest)

tender dagger
#

Is it possible to add conditional operators like and() or or() in guards,
something like this,
{
on: {
[someEvent]: {
guard: or(
stateIn('someStateB'),
stateIn('someStateA'),
),
target: 'someStateC',
}
}
}

#

Adding conditional operators to inline guards ?

magic crater
#

it looks like you should be able to do that

#

you just need to pass them as Array

#

guard: or([
stateIn('someStateB'),
stateIn('someStateA'),
]),

#

and ofcourse you need to import and/or 🙂

native slate
#

Yep, thanks @magic crater - that's correct