UNPKG

postit-js-core

Version:

[![Netlify Status](https://api.netlify.com/api/v1/badges/72130b1d-f56b-473e-8f3b-50a5af916e64/deploy-status)](https://app.netlify.com/sites/postit-js-demo/deploys) ![Build Status](https://github.com/pinussilvestrus/postit-js/workflows/ci/badge.svg)

28 lines (21 loc) 552 B
import { isAny } from '../modeling/util/ModelingUtil'; function getLabelAttr(semantic) { if (isAny(semantic, [ 'postit:Postit', 'postit:TextBox', 'postit:Group' ])) { return 'name'; } } export function getLabel(element) { var semantic = element.businessObject, attr = getLabelAttr(semantic); if (attr) { return semantic[attr] || ''; } } export function setLabel(element, text) { var semantic = element.businessObject, attr = getLabelAttr(semantic); if (attr) { semantic[attr] = text; } return element; }