How to use the min-dash.isArray 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 / diagram-js / lib / features / create / Create.js View on Github external
this.start = function(event, elements, context) {
    if (!isArray(elements)) {
      elements = [ elements ];
    }

    var shape = find(elements, function(element) {
      return !isConnection(element);
    });

    if (!shape) {

      // at least one shape is required
      return;
    }

    context = assign({
      elements: elements,
      hints: {},
github bpmn-io / diagram-js / lib / features / copy-paste / CopyPaste.js View on Github external
CopyPaste.prototype.copy = function(elements) {
  var allowed,
      tree;

  if (!isArray(elements)) {
    elements = elements ? [ elements ] : [];
  }

  allowed = this._eventBus.fire('copyPaste.canCopyElements', {
    elements: elements
  });

  if (allowed === false) {
    tree = {};
  } else {
    tree = this.createTree(isArray(allowed) ? allowed : elements);
  }

  // we set an empty tree, selection of elements
  // to copy was empty.
  this._clipboard.set(tree);

  this._eventBus.fire('copyPaste.elementsCopied', {
    elements: elements,
    tree: tree
  });

  return tree;
};
github bpmn-io / dmn-js / packages / dmn-js-drd / src / features / context-pad / ContextPadProvider.js View on Github external
var position = assign(getReplaceMenuPosition(element), {
              cursor: { x: event.x, y: event.y }
            });

            popupMenu.open(element, 'dmn-replace', position);
          }
        }
      }
    });
  }


  // delete element entry, only show if allowed by rules
  var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });

  if (isArray(deleteAllowed)) {

    // was the element returned as a deletion candidate?
    deleteAllowed = deleteAllowed[0] === element;
  }

  if (deleteAllowed) {
    assign(actions, {
      'delete': {
        group: 'edit',
        className: 'dmn-icon-trash',
        title: translate('Remove'),
        action: {
          click: removeElement
        }
      }
    });
github bpmn-io / diagram-js / lib / layout / ManhattanLayout.js View on Github external
export function repairConnection(source, target, start, end, waypoints, hints) {

  if (isArray(start)) {
    waypoints = start;
    hints = end;

    start = getMid(source);
    end = getMid(target);
  }

  hints = assign({ preferredLayouts: [] }, hints);
  waypoints = waypoints || [];

  var preferredLayouts = hints.preferredLayouts,
      preferStraight = preferredLayouts.indexOf('straight') !== -1,
      repairedWaypoints;

  // just layout non-existing or simple connections
  // attempt to render straight lines, if required
github bpmn-io / bpmn-js / lib / features / context-pad / ContextPadProvider.js View on Github external
'connect': {
        group: 'connect',
        className: 'bpmn-icon-connection-multi',
        title: translate('Connect using DataInputAssociation'),
        action: {
          click: startConnect,
          dragstart: startConnect
        }
      }
    });
  }

  // delete element entry, only show if allowed by rules
  var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });

  if (isArray(deleteAllowed)) {

    // was the element returned as a deletion candidate?
    deleteAllowed = deleteAllowed[0] === element;
  }

  if (deleteAllowed) {
    assign(actions, {
      'delete': {
        group: 'edit',
        className: 'bpmn-icon-trash',
        title: translate('Remove'),
        action: {
          click: removeElement
        }
      }
    });
github bpmn-io / diagram-js / lib / command / CommandStack.js View on Github external
CommandStack.prototype._markDirty = function(elements) {
  var execution = this._currentExecution;

  if (!elements) {
    return;
  }

  elements = isArray(elements) ? elements : [ elements ];

  execution.dirty = execution.dirty.concat(elements);
};
github bpmn-io / cmmn-js / lib / draw / CmmnRenderer.js View on Github external
function computeStyle(custom, traits, defaultStyles) {
    if (!isArray(traits)) {
      defaultStyles = traits;
      traits = [];
    }

    return styles.style(traits || [], assign(defaultStyles, custom || {}));
  }
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / copy-cut-paste / CopyCutPaste.js View on Github external
copy(elements) {
    if (!isArray(elements)) {
      elements = [ elements ];
    }

    const data = {
      elements: createDescriptor(elements)
    };

    this._eventBus.fire('copyCutPaste.copy', { data });

    this._clipboard.set(data);
  }
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / copy-cut-paste / DescriptorUtil.js View on Github external
export function createDescriptor(element, cache, hooks) {

  hooks = hooks || createHooks;
  cache = cache || {};

  if (isArray(element)) {
    return createDescriptors0(element, cache, hooks);
  } else {
    return createDescriptor0(element, cache, hooks);
  }

}
github bpmn-io / diagram-js / lib / features / bendpoints / BendpointSnapping.js View on Github external
function snapTo(values, value) {

    if (isArray(values)) {
      var i = values.length;

      while (i--) if (abs(values[i] - value) <= TOLERANCE) {
        return values[i];
      }
    } else {
      values = +values;
      var rem = value % values;

      if (rem < TOLERANCE) {
        return value - rem;
      }

      if (rem > values - TOLERANCE) {
        return value - rem + values;
      }