export function is()

in saga/seata-saga-statemachine-designer/src/utils/index.js [61:81]


export function is(element, target) {
  const type = element?.businessObject?.Type || element?.Type || element;

  if (target === 'Event') {
    return type === 'StartState' || type === 'CompensationTrigger' || type === 'Catch' || type === 'Fail' || type === 'Succeed';
  }

  if (target === 'End') {
    return type === 'Fail' || type === 'Succeed';
  }

  if (target === 'Task') {
    return type === 'ServiceTask' || type === 'ScriptTask' || type === 'SubStateMachine';
  }

  if (target === 'Connection') {
    return type === 'Transition' || type === 'ChoiceEntry' || type === 'ExceptionMatch' || type === 'Compensation';
  }

  return type === target;
}