mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-10 17:16:02 +00:00
9be61259bd
We use ES modules, so 'use strict' is not necessary anymore.
25 lines
555 B
JavaScript
25 lines
555 B
JavaScript
/**
|
|
* Is an element of the given BPMN type?
|
|
*
|
|
* @param {djs.model.Base|ModdleElement} element
|
|
* @param {String} type
|
|
*
|
|
* @return {Boolean}
|
|
*/
|
|
export function is(element, type) {
|
|
var bo = getBusinessObject(element);
|
|
|
|
return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
|
|
}
|
|
|
|
|
|
/**
|
|
* Return the business object for a given element.
|
|
*
|
|
* @param {djs.model.Base|ModdleElement} element
|
|
*
|
|
* @return {ModdleElement}
|
|
*/
|
|
export function getBusinessObject(element) {
|
|
return (element && element.businessObject) || element;
|
|
} |