2015-04-27 16:50:09 +02:00
|
|
|
/**
|
|
|
|
* Is an element of the given BPMN type?
|
|
|
|
*
|
|
|
|
* @param {djs.model.Base|ModdleElement} element
|
|
|
|
* @param {String} type
|
|
|
|
*
|
|
|
|
* @return {Boolean}
|
|
|
|
*/
|
2018-04-02 21:01:53 +02:00
|
|
|
export function is(element, type) {
|
2015-04-27 16:50:09 +02:00
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
2015-08-10 15:13:34 +02:00
|
|
|
return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
|
2015-04-27 16:50:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the business object for a given element.
|
|
|
|
*
|
|
|
|
* @param {djs.model.Base|ModdleElement} element
|
|
|
|
*
|
|
|
|
* @return {ModdleElement}
|
|
|
|
*/
|
2018-04-02 21:01:53 +02:00
|
|
|
export function getBusinessObject(element) {
|
2015-04-27 16:50:09 +02:00
|
|
|
return (element && element.businessObject) || element;
|
2018-04-02 21:01:53 +02:00
|
|
|
}
|