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