From a842ee80a6b9e0a402e3a35872e78b426a498f40 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 25 Apr 2014 11:05:08 +0200 Subject: [PATCH] feat(core/BpmnRegistry): api accepts element#id --- lib/core/BpmnRegistry.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/core/BpmnRegistry.js b/lib/core/BpmnRegistry.js index acd5133c..7fdb6fa1 100644 --- a/lib/core/BpmnRegistry.js +++ b/lib/core/BpmnRegistry.js @@ -1,12 +1,13 @@ -var bpmnModule = require('../di').defaultModule; +var _ = require('lodash'); +var bpmnModule = require('../di').defaultModule; /** * @class * * A registry that keeps track of bpmn semantic / di elements and the * corresponding shapes. - * + * * @param {EventBus} events * @param {ElementRegistry} elementRegistry */ @@ -39,8 +40,8 @@ function BpmnRegistry(events, elementRegistry) { function get(type) { var collection = elements[type]; - return function(id) { - return collection[id]; + return function(element) { + return collection[_.isObject(element) ? element.id : element]; }; }