How to use the min-dash.filter function in min-dash

To help you get started, we’ve selected a few min-dash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / bpmn-js / test / spec / features / copy-paste / BpmnCopyPasteSpec.js View on Github external
var participant = elementRegistry.get('Participant_0x9lnke'),
            task = elementRegistry.get('Task_1'),
            newTask;

        // when
        copyPaste.copy([ task ]);

        copyPaste.paste({
          element: participant,
          point: {
            x: 500,
            y: 50
          }
        });

        newTask = filter(participant.children, function(element) {
          return is(element, 'bpmn:Task');
        })[0];

        // then
        var bo = task.businessObject;
        var copiedBo = newTask.businessObject;


        expect(copiedBo.asyncBefore).to.eql(bo.asyncBefore);
        expect(copiedBo.documentation).to.jsonEqual(bo.documentation);

        var copiedExtensions = copiedBo.extensionElements;

        expect(copiedExtensions).to.jsonEqual(bo.extensionElements);
        expect(copiedExtensions.$parent).to.equal(copiedBo);
      })
github bpmn-io / moddle-xml / lib / write.js View on Github external
function getSerializableProperties(element) {
  var descriptor = element.$descriptor;

  return filter(descriptor.properties, function(p) {
    var name = p.name;

    if (p.isVirtual) {
      return false;
    }

    // do not serialize defaults
    if (!element.hasOwnProperty(name)) {
      return false;
    }

    var value = element[name];

    // do not serialize default equals
    if (value === p.default) {
      return false;
github bpmn-io / bpmn-js / lib / features / popup-menu / ReplaceMenuProvider.js View on Github external
return this._createEntries(element, entries);
  }

  // sequence flows
  if (is(businessObject, 'bpmn:SequenceFlow')) {
    return this._createSequenceFlowEntries(element, replaceOptions.SEQUENCE_FLOW);
  }

  // flow nodes
  if (is(businessObject, 'bpmn:FlowNode')) {
    entries = filter(replaceOptions.TASK, differentType);

    // collapsed SubProcess can not be replaced with itself
    if (is(businessObject, 'bpmn:SubProcess') && !isExpanded(businessObject)) {
      entries = filter(entries, function(entry) {
        return entry.label !== 'Sub Process (collapsed)';
      });
    }

    return this._createEntries(element, entries);
  }

  return [];
};
github bpmn-io / diagram-js / lib / features / label-support / LabelSupport.js View on Github external
function removeLabels(elements) {

  return filter(elements, function(element) {

    // filter out labels that are move together
    // with their label targets
    return elements.indexOf(element.labelTarget) === -1;
  });
}
github bptlab / chor-js / lib / features / copy-paste / ChoreoCopyPaste.js View on Github external
let descriptor = context.descriptor;
  const createdElements = context.createdElements;
  const parent = descriptor.parent;
  const rootElement = canvas.getRootElement();
  const oldBusinessObject = descriptor.oldBusinessObject;
  let newBusinessObject;
  let source;
  let target;
  let canConnect;

  newBusinessObject = bpmnFactory.create(oldBusinessObject.$type);

  var properties = getProperties(oldBusinessObject.$descriptor);

  properties = filter(properties, function(property) {
    return IGNORED_PROPERTIES.indexOf(property.replace(/bpmn:/, '')) === -1;
  });

  // copies business object
  descriptor.businessObject = helper.clone(oldBusinessObject, newBusinessObject, properties);

  // clone additional stuff which is specific to choreos and not part of bpmn.js

  if (is(descriptor.oldBusinessObject, 'bpmn:ChoreographyActivity')) {
    descriptor.businessObject.participantRef = descriptor.copyParticipantRef;
    descriptor.businessObject.initiatingParticipantRef = descriptor.copyInitParticpant;
    descriptor.bandShapes = [];
    if (is(descriptor.oldBusinessObject, 'bpmn:CallChoreography')) {
      descriptor.businessObject.participantAssociations = descriptor.copyParticipantAssociations;
      descriptor.businessObject.calledChoreographyRef = descriptor.copyCalledChoreoRef;
    }
github zeebe-io / zeebe-modeler / client / src / remote / Plugins.js View on Github external
loadAll() {

    const appPlugins = this.getAppPlugins();

    const stylePlugins = filter(appPlugins, appPlugin => appPlugin.style),
          scriptPlugins = filter(appPlugins, appPlugin => appPlugin.script);

    // load style plugins
    stylePlugins.forEach(this._loadStylePlugin);

    // load script plugins
    return Promise.all(scriptPlugins.map(this._loadScriptPlugin));
  }
github bpmn-io / diagram-js / lib / features / overlays / Overlays.js View on Github external
if (isString(search.element)) {
    search.element = this._elementRegistry.get(search.element);
  }

  if (search.element) {
    var container = this._getOverlayContainer(search.element, true);

    // return a list of overlays when searching by element (+type)
    if (container) {
      return search.type ? filter(container.overlays, matchPattern({ type: search.type })) : container.overlays.slice();
    } else {
      return [];
    }
  } else
  if (search.type) {
    return filter(this._overlays, matchPattern({ type: search.type }));
  } else {

    // return single element when searching by id
    return search.id ? this._overlays[search.id] : null;
  }
};
github nikku / camunda-playground / packages / client / src / components / viewer / features / ProcessInstance.js View on Github external
function getConnections(activity) {
      const incoming = filter(activity.incoming, connection => {
        const found = find(activities, matchPattern({ id: connection.source.id }));

        const finished = isFinished(found);

        return found && finished;
      });

      const outgoing = filter(activity.outgoing, connection => {
        const found = find(activities, matchPattern({ id: connection.target.id }));

        const finished = isFinished(activity);

        return found && finished;
      });

      return [
        ...incoming,
        ...outgoing
      ];
    }
github bpmn-io / cmmn-js / lib / features / popup-menu / ReplaceMenuProvider.js View on Github external
if (isEventListener(element)) {

      entries = filter(replaceOptions.EVENT_LISTENER, function(entry) {
        return isDifferentDefinitionType(element, entry);
      });

      return this._createEntries(element, entries);
    }

  }


  if (isCriterion(element)) {

    entries = filter(replaceOptions.CRITERION, function(entry) {
      return isDifferentType(element, entry);
    });

    return this._createEntries(element, entries);
  }

  return [];

};