UNPKG

555 BJavaScriptView Raw
1/**
2 * Is an element of the given BPMN type?
3 *
4 * @param {djs.model.Base|ModdleElement} element
5 * @param {String} type
6 *
7 * @return {Boolean}
8 */
9export function is(element, type) {
10 var bo = getBusinessObject(element);
11
12 return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
13}
14
15
16/**
17 * Return the business object for a given element.
18 *
19 * @param {djs.model.Base|ModdleElement} element
20 *
21 * @return {ModdleElement}
22 */
23export function getBusinessObject(element) {
24 return (element && element.businessObject) || element;
25}
\No newline at end of file