From 245d1d6a963d96738bdca1e2061cf94b1da70262 Mon Sep 17 00:00:00 2001 From: TheSharpieOne Bot <37381202+TheSharpieOneBot@users.noreply.github.com> Date: Wed, 14 Mar 2018 16:43:53 -0400 Subject: [PATCH] chore(project): upgrade lodash to min-dash --- lib/Viewer.js | 10 ++++----- lib/draw/BpmnRenderUtil.js | 4 ++-- lib/draw/BpmnRenderer.js | 6 ++--- lib/features/auto-place/AutoPlaceUtil.js | 4 ++-- .../auto-resize/BpmnAutoResizeProvider.js | 2 +- .../context-pad/ContextPadProvider.js | 6 ++--- lib/features/copy-paste/BpmnCopyPaste.js | 4 ++-- .../BpmnDistributeElements.js | 2 +- .../editor-actions/BpmnEditorActions.js | 2 +- .../label-editing/LabelEditingProvider.js | 2 +- lib/features/modeling/BpmnFactory.js | 6 ++--- lib/features/modeling/BpmnLayouter.js | 2 +- lib/features/modeling/BpmnUpdater.js | 4 ++-- lib/features/modeling/ElementFactory.js | 4 ++-- .../modeling/behavior/CopyPasteBehavior.js | 2 +- .../behavior/DataInputAssociationBehavior.js | 2 +- .../modeling/behavior/DropOnFlowBehavior.js | 4 ++-- .../modeling/behavior/LabelBehavior.js | 2 +- .../behavior/ReplaceConnectionBehavior.js | 4 ++-- .../behavior/ReplaceElementBehaviour.js | 2 +- .../modeling/behavior/UnclaimIdBehavior.js | 2 +- lib/features/modeling/cmd/AddLaneHandler.js | 2 +- lib/features/modeling/cmd/SetColorHandler.js | 4 ++-- .../modeling/cmd/UpdatePropertiesHandler.js | 8 +++---- lib/features/modeling/util/ModelingUtil.js | 2 +- lib/features/ordering/BpmnOrderingProvider.js | 4 ++-- lib/features/palette/PaletteProvider.js | 2 +- .../popup-menu/ReplaceMenuProvider.js | 9 ++++---- .../replace-preview/BpmnReplacePreview.js | 4 ++-- lib/features/replace/BpmnReplace.js | 22 ++++++++++--------- lib/features/rules/BpmnRules.js | 10 ++++----- lib/features/search/BpmnSearchProvider.js | 6 ++--- lib/features/snapping/BpmnSnapping.js | 4 ++-- lib/import/BpmnImporter.js | 4 ++-- lib/import/BpmnTreeWalker.js | 6 ++--- lib/util/DiUtil.js | 2 +- lib/util/LabelUtil.js | 2 +- lib/util/model/ModelCloneHelper.js | 12 +++++----- lib/util/model/ModelCloneUtils.js | 2 +- package.json | 2 +- test/config/translation-reporter.js | 8 +++---- test/helper/index.js | 13 ++++++----- .../custom-elements/CustomElementFactory.js | 2 +- .../custom-elements/CustomRules.js | 2 +- test/matchers/BoundsMatchers.js | 2 +- test/matchers/ConnectionMatchers.js | 2 +- .../features/auto-resize/AutoResizeSpec.js | 4 ++-- .../features/copy-paste/BpmnCopyPasteSpec.js | 10 ++++----- .../features/copy-paste/DescriptorTree.js | 2 +- .../editor-actions/BpmnEditorActionsSpec.js | 2 +- .../label-editing/LabelEditingPreviewSpec.js | 2 +- .../spec/features/modeling/AppendShapeSpec.js | 2 +- .../modeling/append/TextAnnotationSpec.js | 2 +- .../DataInputAssociationBehaviorSpec.js | 2 +- .../behavior/DropOnFlowBehaviorSpec.js | 2 +- .../behavior/ReplaceConnectionBehaviorSpec.js | 2 +- .../features/modeling/lanes/AddLaneSpec.js | 2 +- .../features/modeling/lanes/DeleteLaneSpec.js | 2 +- .../features/modeling/lanes/ResizeLaneSpec.js | 2 +- .../features/modeling/lanes/SplitLaneSpec.js | 2 +- test/spec/features/ordering/Helper.js | 4 ++-- .../popup-menu/ReplaceMenuProviderSpec.js | 5 +++-- .../replace-preview/BpmnReplacePreviewSpec.js | 2 +- test/spec/import/ImporterSpec.js | 2 +- test/spec/util/camunda-moddle.js | 2 +- test/spec/util/flatten.js | 3 +++ test/util/MockEvents.js | 2 +- test/util/merge.js | 20 +++++++++++++++++ 68 files changed, 158 insertions(+), 132 deletions(-) create mode 100644 test/spec/util/flatten.js create mode 100644 test/util/merge.js diff --git a/lib/Viewer.js b/lib/Viewer.js index 31cf1ce0..0e9e26d0 100644 --- a/lib/Viewer.js +++ b/lib/Viewer.js @@ -6,9 +6,8 @@ */ 'use strict'; -var assign = require('lodash/object/assign'), - omit = require('lodash/object/omit'), - isNumber = require('lodash/lang/isNumber'); +var assign = require('min-dash').assign, + isNumber = require('min-dash').isNumber; var domify = require('min-dom').domify, domQuery = require('min-dom').query, @@ -412,8 +411,9 @@ Viewer.prototype._init = function(container, moddle, options) { ]; var diagramModules = [].concat(staticModules, baseModules, additionalModules); - - var diagramOptions = assign(omit(options, 'additionalModules'), { + var optionsWithoutAdditionalModules = assign({}, options); + delete optionsWithoutAdditionalModules.additionalModules; + var diagramOptions = assign(optionsWithoutAdditionalModules, { canvas: assign({}, options.canvas, { container: container }), modules: diagramModules }); diff --git a/lib/draw/BpmnRenderUtil.js b/lib/draw/BpmnRenderUtil.js index 123900b2..e2dee87a 100644 --- a/lib/draw/BpmnRenderUtil.js +++ b/lib/draw/BpmnRenderUtil.js @@ -1,7 +1,7 @@ 'use strict'; -var every = require('lodash/collection/every'), - some = require('lodash/collection/some'); +var every = require('min-dash').every, + some = require('min-dash').some; var componentsToPath = require('diagram-js/lib/util/RenderUtil').componentsToPath; diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index db2c8204..7c7c7c7b 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -1,9 +1,9 @@ 'use strict'; var inherits = require('inherits'), - isObject = require('lodash/lang/isObject'), - assign = require('lodash/object/assign'), - forEach = require('lodash/collection/forEach'); + isObject = require('min-dash').isObject, + assign = require('min-dash').assign, + forEach = require('min-dash').forEach; var BaseRenderer = require('diagram-js/lib/draw/BaseRenderer'), TextUtil = require('diagram-js/lib/util/Text'), diff --git a/lib/features/auto-place/AutoPlaceUtil.js b/lib/features/auto-place/AutoPlaceUtil.js index 202be434..e573c69a 100644 --- a/lib/features/auto-place/AutoPlaceUtil.js +++ b/lib/features/auto-place/AutoPlaceUtil.js @@ -6,8 +6,8 @@ var getMid = require('diagram-js/lib/layout/LayoutUtil').getMid, asTRBL = require('diagram-js/lib/layout/LayoutUtil').asTRBL, getOrientation = require('diagram-js/lib/layout/LayoutUtil').getOrientation; -var find = require('lodash/collection/find'), - reduce = require('lodash/collection/reduce'); +var find = require('min-dash').find, + reduce = require('min-dash').reduce; var DEFAULT_HORIZONTAL_DISTANCE = 50; diff --git a/lib/features/auto-resize/BpmnAutoResizeProvider.js b/lib/features/auto-resize/BpmnAutoResizeProvider.js index 9974fa1e..80f89781 100644 --- a/lib/features/auto-resize/BpmnAutoResizeProvider.js +++ b/lib/features/auto-resize/BpmnAutoResizeProvider.js @@ -4,7 +4,7 @@ var is = require('../../util/ModelUtil').is; var inherits = require('inherits'); -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; var AutoResizeProvider = require('diagram-js/lib/features/auto-resize/AutoResizeProvider'); diff --git a/lib/features/context-pad/ContextPadProvider.js b/lib/features/context-pad/ContextPadProvider.js index 0055ac27..f0901288 100644 --- a/lib/features/context-pad/ContextPadProvider.js +++ b/lib/features/context-pad/ContextPadProvider.js @@ -1,9 +1,9 @@ 'use strict'; -var assign = require('lodash/object/assign'), - forEach = require('lodash/collection/forEach'), - isArray = require('lodash/lang/isArray'), +var assign = require('min-dash').assign, + forEach = require('min-dash').forEach, + isArray = require('min-dash').isArray, is = require('../../util/ModelUtil').is, isExpanded = require('../../util/DiUtil').isExpanded, isAny = require('../modeling/util/ModelingUtil').isAny, diff --git a/lib/features/copy-paste/BpmnCopyPaste.js b/lib/features/copy-paste/BpmnCopyPaste.js index 4b98505d..5b9c1b5f 100644 --- a/lib/features/copy-paste/BpmnCopyPaste.js +++ b/lib/features/copy-paste/BpmnCopyPaste.js @@ -11,8 +11,8 @@ var ModelCloneUtils = require('../../util/model/ModelCloneUtils'), var IGNORED_PROPERTIES = ModelCloneUtils.IGNORED_PROPERTIES; -var filter = require('lodash/collection/filter'), - forEach = require('lodash/collection/forEach'); +var filter = require('min-dash').filter, + forEach = require('min-dash').forEach; function setProperties(descriptor, data, properties) { forEach(properties, function(property) { diff --git a/lib/features/distribute-elements/BpmnDistributeElements.js b/lib/features/distribute-elements/BpmnDistributeElements.js index 15641759..dc039544 100644 --- a/lib/features/distribute-elements/BpmnDistributeElements.js +++ b/lib/features/distribute-elements/BpmnDistributeElements.js @@ -1,6 +1,6 @@ 'use strict'; -var filter = require('lodash/collection/filter'); +var filter = require('min-dash').filter; var isAny = require('../modeling/util/ModelingUtil').isAny; diff --git a/lib/features/editor-actions/BpmnEditorActions.js b/lib/features/editor-actions/BpmnEditorActions.js index 68f5984e..fcc7d0fc 100644 --- a/lib/features/editor-actions/BpmnEditorActions.js +++ b/lib/features/editor-actions/BpmnEditorActions.js @@ -4,7 +4,7 @@ var inherits = require('inherits'); var EditorActions = require('diagram-js/lib/features/editor-actions/EditorActions'); -var filter = require('lodash/collection/filter'); +var filter = require('min-dash').filter; var is = require('../../util/ModelUtil').is; diff --git a/lib/features/label-editing/LabelEditingProvider.js b/lib/features/label-editing/LabelEditingProvider.js index 239ca6de..75d75c48 100644 --- a/lib/features/label-editing/LabelEditingProvider.js +++ b/lib/features/label-editing/LabelEditingProvider.js @@ -1,6 +1,6 @@ 'use strict'; -var assign = require('lodash/object/assign'); +var assign = require('min-dash').assign; var LabelUtil = require('./LabelUtil'); diff --git a/lib/features/modeling/BpmnFactory.js b/lib/features/modeling/BpmnFactory.js index 92252cb8..b07bc709 100644 --- a/lib/features/modeling/BpmnFactory.js +++ b/lib/features/modeling/BpmnFactory.js @@ -1,8 +1,8 @@ 'use strict'; -var map = require('lodash/collection/map'), - assign = require('lodash/object/assign'), - pick = require('lodash/object/pick'); +var map = require('min-dash').map, + assign = require('min-dash').assign, + pick = require('min-dash').pick; function BpmnFactory(moddle) { diff --git a/lib/features/modeling/BpmnLayouter.js b/lib/features/modeling/BpmnLayouter.js index 1793464a..5be9d207 100644 --- a/lib/features/modeling/BpmnLayouter.js +++ b/lib/features/modeling/BpmnLayouter.js @@ -2,7 +2,7 @@ var inherits = require('inherits'); -var assign = require('lodash/object/assign'); +var assign = require('min-dash').assign; var BaseLayouter = require('diagram-js/lib/layout/BaseLayouter'), ManhattanLayout = require('diagram-js/lib/layout/ManhattanLayout'); diff --git a/lib/features/modeling/BpmnUpdater.js b/lib/features/modeling/BpmnUpdater.js index b1ff1a25..2a1ccf85 100644 --- a/lib/features/modeling/BpmnUpdater.js +++ b/lib/features/modeling/BpmnUpdater.js @@ -1,7 +1,7 @@ 'use strict'; -var assign = require('lodash/object/assign'), - forEach = require('lodash/collection/forEach'), +var assign = require('min-dash').assign, + forEach = require('min-dash').forEach, inherits = require('inherits'); var Collections = require('diagram-js/lib/util/Collections'), diff --git a/lib/features/modeling/ElementFactory.js b/lib/features/modeling/ElementFactory.js index 6d88b3d6..32903439 100644 --- a/lib/features/modeling/ElementFactory.js +++ b/lib/features/modeling/ElementFactory.js @@ -1,7 +1,7 @@ 'use strict'; -var assign = require('lodash/object/assign'), - forEach = require('lodash/collection/forEach'), +var assign = require('min-dash').assign, + forEach = require('min-dash').forEach, inherits = require('inherits'); var is = require('../../util/ModelUtil').is; diff --git a/lib/features/modeling/behavior/CopyPasteBehavior.js b/lib/features/modeling/behavior/CopyPasteBehavior.js index e8bcb768..09a4183d 100644 --- a/lib/features/modeling/behavior/CopyPasteBehavior.js +++ b/lib/features/modeling/behavior/CopyPasteBehavior.js @@ -2,7 +2,7 @@ var inherits = require('inherits'); -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; var is = require('../../../util/ModelUtil').is; diff --git a/lib/features/modeling/behavior/DataInputAssociationBehavior.js b/lib/features/modeling/behavior/DataInputAssociationBehavior.js index b5a09c0d..85b1a011 100644 --- a/lib/features/modeling/behavior/DataInputAssociationBehavior.js +++ b/lib/features/modeling/behavior/DataInputAssociationBehavior.js @@ -6,7 +6,7 @@ var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor'); var Collections = require('diagram-js/lib/util/Collections'); -var find = require('lodash/collection/find'); +var find = require('min-dash').find; var is = require('../../../util/ModelUtil').is; diff --git a/lib/features/modeling/behavior/DropOnFlowBehavior.js b/lib/features/modeling/behavior/DropOnFlowBehavior.js index a928d5ea..35c4b9ef 100644 --- a/lib/features/modeling/behavior/DropOnFlowBehavior.js +++ b/lib/features/modeling/behavior/DropOnFlowBehavior.js @@ -2,8 +2,8 @@ var inherits = require('inherits'); -var assign = require('lodash/object/assign'), - find = require('lodash/collection/find'); +var assign = require('min-dash').assign, + find = require('min-dash').find; var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor'); diff --git a/lib/features/modeling/behavior/LabelBehavior.js b/lib/features/modeling/behavior/LabelBehavior.js index 42c57c21..4bf30e77 100644 --- a/lib/features/modeling/behavior/LabelBehavior.js +++ b/lib/features/modeling/behavior/LabelBehavior.js @@ -1,6 +1,6 @@ 'use strict'; -var assign = require('lodash/object/assign'), +var assign = require('min-dash').assign, inherits = require('inherits'); var LabelUtil = require('../../../util/LabelUtil'), diff --git a/lib/features/modeling/behavior/ReplaceConnectionBehavior.js b/lib/features/modeling/behavior/ReplaceConnectionBehavior.js index 92138820..fcd80b70 100644 --- a/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +++ b/lib/features/modeling/behavior/ReplaceConnectionBehavior.js @@ -1,7 +1,7 @@ 'use strict'; -var forEach = require('lodash/collection/forEach'), - find = require('lodash/collection/find'), +var forEach = require('min-dash').forEach, + find = require('min-dash').find, inherits = require('inherits'); var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor'); diff --git a/lib/features/modeling/behavior/ReplaceElementBehaviour.js b/lib/features/modeling/behavior/ReplaceElementBehaviour.js index 98b9c50c..bee3b747 100644 --- a/lib/features/modeling/behavior/ReplaceElementBehaviour.js +++ b/lib/features/modeling/behavior/ReplaceElementBehaviour.js @@ -4,7 +4,7 @@ var inherits = require('inherits'); var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor'); -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; var isEventSubProcess = require('../../../util/DiUtil').isEventSubProcess; var is = require('../../../util/ModelUtil').is; diff --git a/lib/features/modeling/behavior/UnclaimIdBehavior.js b/lib/features/modeling/behavior/UnclaimIdBehavior.js index da097c89..0eb6c1e8 100644 --- a/lib/features/modeling/behavior/UnclaimIdBehavior.js +++ b/lib/features/modeling/behavior/UnclaimIdBehavior.js @@ -1,6 +1,6 @@ 'use strict'; -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; var inherits = require('inherits'); diff --git a/lib/features/modeling/cmd/AddLaneHandler.js b/lib/features/modeling/cmd/AddLaneHandler.js index 8e3139e9..365a10a6 100644 --- a/lib/features/modeling/cmd/AddLaneHandler.js +++ b/lib/features/modeling/cmd/AddLaneHandler.js @@ -1,6 +1,6 @@ 'use strict'; -var filter = require('lodash/collection/filter'); +var filter = require('min-dash').filter; var Elements = require('diagram-js/lib/util/Elements'); diff --git a/lib/features/modeling/cmd/SetColorHandler.js b/lib/features/modeling/cmd/SetColorHandler.js index f16c8161..02fce12a 100644 --- a/lib/features/modeling/cmd/SetColorHandler.js +++ b/lib/features/modeling/cmd/SetColorHandler.js @@ -1,7 +1,7 @@ 'use strict'; -var assign = require('lodash/object/assign'), - forEach = require('lodash/collection/forEach'); +var assign = require('min-dash').assign, + forEach = require('min-dash').forEach; var DEFAULT_COLORS = { fill: undefined, diff --git a/lib/features/modeling/cmd/UpdatePropertiesHandler.js b/lib/features/modeling/cmd/UpdatePropertiesHandler.js index 3f73dd64..60601337 100644 --- a/lib/features/modeling/cmd/UpdatePropertiesHandler.js +++ b/lib/features/modeling/cmd/UpdatePropertiesHandler.js @@ -1,9 +1,9 @@ 'use strict'; -var reduce = require('lodash/object/transform'), - keys = require('lodash/object/keys'), - forEach = require('lodash/collection/forEach'), - assign = require('lodash/object/assign'); +var reduce = require('min-dash').transform, + keys = require('min-dash').keys, + forEach = require('min-dash').forEach, + assign = require('min-dash').assign; var getBusinessObject = require('../../../util/ModelUtil').getBusinessObject; diff --git a/lib/features/modeling/util/ModelingUtil.js b/lib/features/modeling/util/ModelingUtil.js index 65b64228..8e08f84a 100644 --- a/lib/features/modeling/util/ModelingUtil.js +++ b/lib/features/modeling/util/ModelingUtil.js @@ -1,6 +1,6 @@ 'use strict'; -var any = require('lodash/collection/any'); +var any = require('min-dash').any; var is = require('../../../util/ModelUtil').is; diff --git a/lib/features/ordering/BpmnOrderingProvider.js b/lib/features/ordering/BpmnOrderingProvider.js index e5c32bcb..f745bd79 100644 --- a/lib/features/ordering/BpmnOrderingProvider.js +++ b/lib/features/ordering/BpmnOrderingProvider.js @@ -6,9 +6,9 @@ var OrderingProvider = require('diagram-js/lib/features/ordering/OrderingProvide var isAny = require('../modeling/util/ModelingUtil').isAny; -var findIndex = require('lodash/array/findIndex'); +var findIndex = require('min-dash').findIndex; -var find = require('lodash/collection/find'); +var find = require('min-dash').find; /** diff --git a/lib/features/palette/PaletteProvider.js b/lib/features/palette/PaletteProvider.js index 6a6a656c..2904c5f1 100644 --- a/lib/features/palette/PaletteProvider.js +++ b/lib/features/palette/PaletteProvider.js @@ -1,6 +1,6 @@ 'use strict'; -var assign = require('lodash/object/assign'); +var assign = require('min-dash').assign; /** * A palette provider for BPMN 2.0 elements. diff --git a/lib/features/popup-menu/ReplaceMenuProvider.js b/lib/features/popup-menu/ReplaceMenuProvider.js index 8b3ed599..019f8add 100644 --- a/lib/features/popup-menu/ReplaceMenuProvider.js +++ b/lib/features/popup-menu/ReplaceMenuProvider.js @@ -6,9 +6,8 @@ var is = require('../../util/ModelUtil').is, isExpanded = require('../../util/DiUtil').isExpanded, isDifferentType = require('./util/TypeUtil').isDifferentType; -var forEach = require('lodash/collection/forEach'), - filter = require('lodash/collection/filter'), - reject = require('lodash/collection/reject'); +var forEach = require('min-dash').forEach, + filter = require('min-dash').filter; var replaceOptions = require ('../replace/ReplaceOptions'); @@ -214,8 +213,8 @@ ReplaceMenuProvider.prototype.getEntries = function(element) { // collapsed SubProcess can not be replaced with itself if (is(businessObject, 'bpmn:SubProcess') && !isExpanded(businessObject)) { - entries = reject(entries, function(entry) { - return entry.label === 'Sub Process (collapsed)'; + entries = filter(entries, function(entry) { + return entry.label !== 'Sub Process (collapsed)'; }); } diff --git a/lib/features/replace-preview/BpmnReplacePreview.js b/lib/features/replace-preview/BpmnReplacePreview.js index 4032142b..85349119 100644 --- a/lib/features/replace-preview/BpmnReplacePreview.js +++ b/lib/features/replace-preview/BpmnReplacePreview.js @@ -4,8 +4,8 @@ var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor'); var inherits = require('inherits'); -var assign = require('lodash/object/assign'), - forEach = require('lodash/collection/forEach'); +var assign = require('min-dash').assign, + forEach = require('min-dash').forEach; var domQuery = require('min-dom').query; diff --git a/lib/features/replace/BpmnReplace.js b/lib/features/replace/BpmnReplace.js index e98c4350..23e0d4dd 100644 --- a/lib/features/replace/BpmnReplace.js +++ b/lib/features/replace/BpmnReplace.js @@ -1,10 +1,10 @@ 'use strict'; -var pick = require('lodash/object/pick'), - assign = require('lodash/object/assign'), - intersection = require('lodash/array/intersection'), - filter = require('lodash/collection/filter'), - has = require('lodash/object/has'); +var pick = require('min-dash').pick, + assign = require('min-dash').assign, + uniqueBy = require('min-dash').uniqueBy, + findIndex = require('min-dash').findIndex, + filter = require('min-dash').filter; var is = require('../../util/ModelUtil').is, isAny = require('../modeling/util/ModelingUtil').isAny, @@ -29,15 +29,15 @@ var CUSTOM_PROPERTIES = [ function toggeling(element, target) { var oldCollapsed = ( - has(element, 'collapsed') ? element.collapsed : !isExpanded(element) + element && hasOwnProperty(element, 'collapsed') ? element.collapsed : !isExpanded(element) ); var targetCollapsed; - if (has(target, 'collapsed') || has(target, 'isExpanded')) { + if (target && (hasOwnProperty(target, 'collapsed') || hasOwnProperty(target, 'isExpanded'))) { // property is explicitly set so use it targetCollapsed = ( - has(target, 'collapsed') ? target.collapsed : !target.isExpanded + hasOwnProperty(target, 'collapsed') ? target.collapsed : !target.isExpanded ); } else { // keep old state @@ -98,7 +98,9 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) { var elementProps = getProperties(oldBusinessObject.$descriptor), newElementProps = getProperties(newBusinessObject.$descriptor, true), - properties = intersection(elementProps, newElementProps); + properties = uniqueBy(function(e) { return e; }, filter(elementProps, function(value) { + return findIndex(newElementProps, value) !== -1; + })); // initialize special properties defined in target definition assign(newBusinessObject, pick(target, CUSTOM_PROPERTIES)); @@ -139,7 +141,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) { newElement.isExpanded = isExpanded(oldBusinessObject); } // else if property is explicitly set, use it - else if (has(target, 'isExpanded')) { + else if (target && hasOwnProperty(target, 'isExpanded')) { newElement.isExpanded = target.isExpanded; } diff --git a/lib/features/rules/BpmnRules.js b/lib/features/rules/BpmnRules.js index 35f77337..0d5ed57f 100644 --- a/lib/features/rules/BpmnRules.js +++ b/lib/features/rules/BpmnRules.js @@ -1,10 +1,10 @@ 'use strict'; -var find = require('lodash/collection/find'), - any = require('lodash/collection/any'), - every = require('lodash/collection/every'), - filter = require('lodash/collection/filter'), - forEach = require('lodash/collection/forEach'), +var find = require('min-dash').find, + any = require('min-dash').any, + every = require('min-dash').every, + filter = require('min-dash').filter, + forEach = require('min-dash').forEach, inherits = require('inherits'); var is = require('../../util/ModelUtil').is, diff --git a/lib/features/search/BpmnSearchProvider.js b/lib/features/search/BpmnSearchProvider.js index bb079d13..f440c121 100644 --- a/lib/features/search/BpmnSearchProvider.js +++ b/lib/features/search/BpmnSearchProvider.js @@ -1,8 +1,8 @@ 'use strict'; -var map = require('lodash/collection/map'), - filter = require('lodash/collection/filter'), - sortBy = require('lodash/collection/sortBy'); +var map = require('min-dash').map, + filter = require('min-dash').filter, + sortBy = require('min-dash').sortBy; var labelUtil = require('../label-editing/LabelUtil'); diff --git a/lib/features/snapping/BpmnSnapping.js b/lib/features/snapping/BpmnSnapping.js index 72046df1..090c35ee 100644 --- a/lib/features/snapping/BpmnSnapping.js +++ b/lib/features/snapping/BpmnSnapping.js @@ -2,8 +2,8 @@ var inherits = require('inherits'); -var forEach = require('lodash/collection/forEach'), - assign = require('lodash/object/assign'); +var forEach = require('min-dash').forEach, + assign = require('min-dash').assign; var getBoundingBox = require('diagram-js/lib/util/Elements').getBBox; diff --git a/lib/import/BpmnImporter.js b/lib/import/BpmnImporter.js index 0fa07f36..735330cf 100644 --- a/lib/import/BpmnImporter.js +++ b/lib/import/BpmnImporter.js @@ -1,7 +1,7 @@ 'use strict'; -var assign = require('lodash/object/assign'), - map = require('lodash/collection/map'); +var assign = require('min-dash').assign, + map = require('min-dash').map; var LabelUtil = require('../util/LabelUtil'); diff --git a/lib/import/BpmnTreeWalker.js b/lib/import/BpmnTreeWalker.js index 25e21bcd..02b1bb1f 100644 --- a/lib/import/BpmnTreeWalker.js +++ b/lib/import/BpmnTreeWalker.js @@ -1,8 +1,8 @@ 'use strict'; -var filter = require('lodash/collection/filter'), - find = require('lodash/collection/find'), - forEach = require('lodash/collection/forEach'); +var filter = require('min-dash').filter, + find = require('min-dash').find, + forEach = require('min-dash').forEach; var Refs = require('object-refs'); diff --git a/lib/util/DiUtil.js b/lib/util/DiUtil.js index d266a3ec..46143ad7 100644 --- a/lib/util/DiUtil.js +++ b/lib/util/DiUtil.js @@ -3,7 +3,7 @@ var is = require('./ModelUtil').is, getBusinessObject = require('./ModelUtil').getBusinessObject; -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; module.exports.isExpanded = function(element) { diff --git a/lib/util/LabelUtil.js b/lib/util/LabelUtil.js index bbe55d5c..137fee68 100644 --- a/lib/util/LabelUtil.js +++ b/lib/util/LabelUtil.js @@ -1,6 +1,6 @@ 'use strict'; -var assign = require('lodash/object/assign'); +var assign = require('min-dash').assign; var is = require('./ModelUtil').is; diff --git a/lib/util/model/ModelCloneHelper.js b/lib/util/model/ModelCloneHelper.js index 81a3e975..74171294 100644 --- a/lib/util/model/ModelCloneHelper.js +++ b/lib/util/model/ModelCloneHelper.js @@ -1,10 +1,10 @@ 'use strict'; -var forEach = require('lodash/collection/forEach'), - filter = require('lodash/collection/filter'), - any = require('lodash/collection/any'), - sort = require('lodash/collection/sortBy'), - isArray = require('lodash/lang/isArray'); +var forEach = require('min-dash').forEach, + filter = require('min-dash').filter, + any = require('min-dash').any, + sortBy = require('min-dash').sortBy, + isArray = require('min-dash').isArray; var IGNORED_PROPERTIES = require('./ModelCloneUtils').IGNORED_PROPERTIES; @@ -47,7 +47,7 @@ ModelCloneHelper.prototype.clone = function(refElement, newElement, properties) // we want the extensionElements to be cloned last // so that they can check certain properties - properties = sort(properties, function(prop) { + properties = sortBy(properties, function(prop) { return prop === 'bpmn:extensionElements'; }); diff --git a/lib/util/model/ModelCloneUtils.js b/lib/util/model/ModelCloneUtils.js index 9098817f..39be261c 100644 --- a/lib/util/model/ModelCloneUtils.js +++ b/lib/util/model/ModelCloneUtils.js @@ -1,6 +1,6 @@ 'use strict'; -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; /** * These are the properties that should be ignored when cloning elements. diff --git a/package.json b/package.json index d2ccf571..7033082c 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "diagram-js-direct-editing": "^0.23.0", "ids": "^0.2.0", "inherits": "^2.0.1", - "lodash": "^3.0.1", + "min-dash": "^2.0.0", "min-dom": "^2.0.1", "object-refs": "^0.1.1", "tiny-svg": "^0.1.3" diff --git a/test/config/translation-reporter.js b/test/config/translation-reporter.js index 8da17e35..130a5dbf 100644 --- a/test/config/translation-reporter.js +++ b/test/config/translation-reporter.js @@ -3,8 +3,8 @@ var fs = require('fs'); var path = require('path'); -var unique = require('lodash/array/unique'); -var sortBy = require('lodash/collection/sortBy'); +var uniqueBy = require('min-dash').uniqueBy; +var sortBy = require('min-dash').sortBy; function TranslationReporter() { process.env.TRANSLATIONS = 'enabled'; @@ -37,8 +37,8 @@ function TranslationReporter() { this.onRunComplete = function() { - translations = unique(translations); - translations = sortBy(translations); + translations = uniqueBy(function(e) {return e;}, translations); + translations = sortBy(translations, function(e) {return e;}); fs.writeFileSync(outputFile, JSON.stringify(translations, null, 2)); }; diff --git a/test/helper/index.js b/test/helper/index.js index 35ff78ee..88ed3084 100644 --- a/test/helper/index.js +++ b/test/helper/index.js @@ -28,16 +28,17 @@ * ``` */ -var unique = require('lodash/array/unique'), - isFunction = require('lodash/lang/isFunction'), - merge = require('lodash/object/merge'), - forEach = require('lodash/collection/forEach'); +var uniqueBy = require('min-dash').uniqueBy, + isFunction = require('min-dash').isFunction, + forEach = require('min-dash').forEach; var TestContainer = require('mocha-test-container-support'); var Modeler = require('../../lib/Modeler'), Viewer = require('../../lib/Viewer'); +var merge = require('../util/merge'); + var OPTIONS, BPMN_JS; var translationModule = require('./TranslationCollector'); @@ -96,7 +97,7 @@ function bootstrapBpmnJS(BpmnJS, diagram, options, locals) { _options.modules = [].concat(_options.modules || [], [ mockModule ]); } - _options.modules = unique(_options.modules); + _options.modules = uniqueBy(function(e) {return e;}, _options.modules); if (!_options.modules.length) { _options.modules = undefined; @@ -105,7 +106,7 @@ function bootstrapBpmnJS(BpmnJS, diagram, options, locals) { // used to extract translations used during tests if (window.__env__ && window.__env__.TRANSLATIONS === 'enabled') { _options.additionalModules = [].concat(_options.additionalModules || [], [ translationModule ]); - _options.additionalModules = unique(_options.additionalModules); + _options.additionalModules = uniqueBy(function(e) {return e;}, _options.additionalModules); } // clean up old bpmn-js instance diff --git a/test/integration/custom-elements/CustomElementFactory.js b/test/integration/custom-elements/CustomElementFactory.js index 6e9e3fb5..08df880a 100644 --- a/test/integration/custom-elements/CustomElementFactory.js +++ b/test/integration/custom-elements/CustomElementFactory.js @@ -1,6 +1,6 @@ 'use strict'; -var assign = require('lodash/object/assign'), +var assign = require('min-dash').assign, inherits = require('inherits'); var BpmnElementFactory = require('lib/features/modeling/ElementFactory'), diff --git a/test/integration/custom-elements/CustomRules.js b/test/integration/custom-elements/CustomRules.js index 68bda94d..e530baaf 100644 --- a/test/integration/custom-elements/CustomRules.js +++ b/test/integration/custom-elements/CustomRules.js @@ -1,6 +1,6 @@ 'use strict'; -var forEach = require('lodash/collection/forEach'), +var forEach = require('min-dash').forEach, inherits = require('inherits'); var RuleProvider = require('diagram-js/lib/features/rules/RuleProvider'); diff --git a/test/matchers/BoundsMatchers.js b/test/matchers/BoundsMatchers.js index 24c6dfd4..07b2fa48 100644 --- a/test/matchers/BoundsMatchers.js +++ b/test/matchers/BoundsMatchers.js @@ -1,6 +1,6 @@ 'use strict'; -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var BOUNDS_ATTRS = [ 'x', 'y', 'width', 'height' ], POSITION_ATTRS = [ 'x', 'y' ], diff --git a/test/matchers/ConnectionMatchers.js b/test/matchers/ConnectionMatchers.js index 89c8f20c..9ffe4a2f 100644 --- a/test/matchers/ConnectionMatchers.js +++ b/test/matchers/ConnectionMatchers.js @@ -1,6 +1,6 @@ 'use strict'; -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var POSITION_ATTRS = [ 'x', 'y' ]; diff --git a/test/spec/features/auto-resize/AutoResizeSpec.js b/test/spec/features/auto-resize/AutoResizeSpec.js index 8c4e1e80..9e8cbafa 100644 --- a/test/spec/features/auto-resize/AutoResizeSpec.js +++ b/test/spec/features/auto-resize/AutoResizeSpec.js @@ -4,8 +4,8 @@ require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var pick = require('lodash/object/pick'), - assign = require('lodash/object/assign'); +var pick = require('min-dash').pick, + assign = require('min-dash').assign; var autoResizeModule = require('lib/features/auto-resize'), modelingModule = require('lib/features/modeling'), diff --git a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js index 4332fd60..9a5f53f0 100644 --- a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +++ b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js @@ -10,10 +10,10 @@ var bpmnCopyPasteModule = require('lib/features/copy-paste'), modelingModule = require('lib/features/modeling'), coreModule = require('lib/core'); -var map = require('lodash/collection/map'), - filter = require('lodash/collection/filter'), - forEach = require('lodash/collection/forEach'), - uniq = require('lodash/array/uniq'); +var map = require('min-dash').map, + filter = require('min-dash').filter, + forEach = require('min-dash').forEach, + uniqueBy = require('min-dash').uniqueBy; var DescriptorTree = require('./DescriptorTree'); @@ -594,7 +594,7 @@ describe('features/copy-paste', function() { return e.businessObject.processRef.id; }); - expect(uniq(processIds)).to.have.length(4); + expect(uniqueBy(function(e) {return e;}, processIds)).to.have.length(4); } )); diff --git a/test/spec/features/copy-paste/DescriptorTree.js b/test/spec/features/copy-paste/DescriptorTree.js index 4564d1d2..7949f349 100644 --- a/test/spec/features/copy-paste/DescriptorTree.js +++ b/test/spec/features/copy-paste/DescriptorTree.js @@ -1,6 +1,6 @@ 'use strict'; -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; function DescriptorTree(tree) { diff --git a/test/spec/features/editor-actions/BpmnEditorActionsSpec.js b/test/spec/features/editor-actions/BpmnEditorActionsSpec.js index bcca1285..8f4e640d 100644 --- a/test/spec/features/editor-actions/BpmnEditorActionsSpec.js +++ b/test/spec/features/editor-actions/BpmnEditorActionsSpec.js @@ -4,7 +4,7 @@ require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var getBBox = require('diagram-js/lib/util/Elements').getBBox; diff --git a/test/spec/features/label-editing/LabelEditingPreviewSpec.js b/test/spec/features/label-editing/LabelEditingPreviewSpec.js index 5ef7fca4..d5740ffb 100644 --- a/test/spec/features/label-editing/LabelEditingPreviewSpec.js +++ b/test/spec/features/label-editing/LabelEditingPreviewSpec.js @@ -2,7 +2,7 @@ /* global bootstrapViewer, inject */ -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var labelEditingModule = require('lib/features/label-editing'), coreModule = require('lib/core'), diff --git a/test/spec/features/modeling/AppendShapeSpec.js b/test/spec/features/modeling/AppendShapeSpec.js index e5d57a46..40c28c42 100644 --- a/test/spec/features/modeling/AppendShapeSpec.js +++ b/test/spec/features/modeling/AppendShapeSpec.js @@ -2,7 +2,7 @@ /* global bootstrapModeler, inject */ -var find = require('lodash/collection/find'); +var find = require('min-dash').find; var modelingModule = require('lib/features/modeling'), diff --git a/test/spec/features/modeling/append/TextAnnotationSpec.js b/test/spec/features/modeling/append/TextAnnotationSpec.js index d922ca11..e43278c5 100644 --- a/test/spec/features/modeling/append/TextAnnotationSpec.js +++ b/test/spec/features/modeling/append/TextAnnotationSpec.js @@ -5,7 +5,7 @@ require('../../../../TestHelper'); /* global bootstrapModeler, inject */ -var find = require('lodash/collection/find'); +var find = require('min-dash').find; var modelingModule = require('lib/features/modeling'), coreModule = require('lib/core'); diff --git a/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js b/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js index 6dc63df5..90ee5008 100644 --- a/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js @@ -4,7 +4,7 @@ require('../../../../TestHelper'); /* global inject, bootstrapModeler */ -var find = require('lodash/collection/find'); +var find = require('min-dash').find; var modelingModule = require('lib/features/modeling'); diff --git a/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js b/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js index 854142fd..4211e616 100644 --- a/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js @@ -4,7 +4,7 @@ require('../../../../TestHelper'); /* global inject, bootstrapModeler */ -var flatten = require('lodash/array/flatten'); +var flatten = require('../../../util/flatten'); var coreModule = require('lib/core'), moveModule = require('diagram-js/lib/features/move'), diff --git a/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js b/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js index e142e230..3f000852 100644 --- a/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js @@ -5,7 +5,7 @@ require('../../../../TestHelper'); /* global bootstrapModeler, inject */ var is = require('lib/util/ModelUtil').is, - find = require('lodash/collection/find'); + find = require('min-dash').find; var modelingModule = require('lib/features/modeling'), moveModule = require('diagram-js/lib/features/move'), diff --git a/test/spec/features/modeling/lanes/AddLaneSpec.js b/test/spec/features/modeling/lanes/AddLaneSpec.js index a66350eb..fb953dc0 100644 --- a/test/spec/features/modeling/lanes/AddLaneSpec.js +++ b/test/spec/features/modeling/lanes/AddLaneSpec.js @@ -5,7 +5,7 @@ require('../../../../TestHelper'); /* global bootstrapModeler, inject */ -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var modelingModule = require('lib/features/modeling'), coreModule = require('lib/core'); diff --git a/test/spec/features/modeling/lanes/DeleteLaneSpec.js b/test/spec/features/modeling/lanes/DeleteLaneSpec.js index 4a4c5281..690bba32 100644 --- a/test/spec/features/modeling/lanes/DeleteLaneSpec.js +++ b/test/spec/features/modeling/lanes/DeleteLaneSpec.js @@ -4,7 +4,7 @@ require('../../../../TestHelper'); /* global bootstrapModeler, inject */ -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var modelingModule = require('lib/features/modeling'), coreModule = require('lib/core'); diff --git a/test/spec/features/modeling/lanes/ResizeLaneSpec.js b/test/spec/features/modeling/lanes/ResizeLaneSpec.js index c267a4f5..5bf32ab5 100644 --- a/test/spec/features/modeling/lanes/ResizeLaneSpec.js +++ b/test/spec/features/modeling/lanes/ResizeLaneSpec.js @@ -11,7 +11,7 @@ var modelingModule = require('lib/features/modeling'), var resizeTRBL = require('diagram-js/lib/features/resize/ResizeUtil').resizeTRBL; -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; function getBounds(element) { return pick(element, [ 'x', 'y', 'width', 'height']); diff --git a/test/spec/features/modeling/lanes/SplitLaneSpec.js b/test/spec/features/modeling/lanes/SplitLaneSpec.js index 137cdd5f..3f9b279c 100644 --- a/test/spec/features/modeling/lanes/SplitLaneSpec.js +++ b/test/spec/features/modeling/lanes/SplitLaneSpec.js @@ -4,7 +4,7 @@ require('../../../../TestHelper'); /* global bootstrapModeler, inject */ -var pick = require('lodash/object/pick'); +var pick = require('min-dash').pick; var modelingModule = require('lib/features/modeling'), coreModule = require('lib/core'); diff --git a/test/spec/features/ordering/Helper.js b/test/spec/features/ordering/Helper.js index e3360bc5..0a79a40a 100644 --- a/test/spec/features/ordering/Helper.js +++ b/test/spec/features/ordering/Helper.js @@ -2,7 +2,7 @@ var TestHelper = require('../../../TestHelper'); -var map = require('lodash/collection/map'); +var map = require('min-dash').map; // polyfill, because Math.sign is not available in PhantomJS, IE and Safari // https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Math/sign @@ -199,7 +199,7 @@ function compareZOrder(a, b) { } -var forEach = require('lodash/collection/forEach'); +var forEach = require('min-dash').forEach; function expectZOrder() { diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index 57fad80b..213f97fc 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -12,8 +12,9 @@ var coreModule = require('lib/core'), customRulesModule = require('../../../util/custom-rules'); var domQuery = require('min-dom').query, - domClasses = require('min-dom').classes, - find = require('lodash/collection/find'); + domClasses = require('min-dom').classes; + +var find = require('min-dash').find; var is = require('lib/util/ModelUtil').is, isExpanded = require('lib/util/DiUtil').isExpanded; diff --git a/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js b/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js index f733a562..91e08da2 100644 --- a/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js +++ b/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js @@ -11,7 +11,7 @@ var replacePreviewModule = require('lib/features/replace-preview'), var canvasEvent = require('../../../util/MockEvents').createCanvasEvent; -var assign = require('lodash/object/assign'); +var assign = require('min-dash').assign; var svgAttr = require('tiny-svg/lib/attr'), svgClone = require('tiny-svg/lib/clone'), diff --git a/test/spec/import/ImporterSpec.js b/test/spec/import/ImporterSpec.js index 041989c8..ee2b5e1a 100644 --- a/test/spec/import/ImporterSpec.js +++ b/test/spec/import/ImporterSpec.js @@ -11,7 +11,7 @@ var domMatches = require('min-dom').matches; var getChildrenGfx = require('diagram-js/lib/util/GraphicsUtil').getChildren; -var find = require('lodash/collection/find'); +var find = require('min-dash').find; var is = require('lib/util/ModelUtil').is; diff --git a/test/spec/util/camunda-moddle.js b/test/spec/util/camunda-moddle.js index 65c2956f..7eb3e454 100644 --- a/test/spec/util/camunda-moddle.js +++ b/test/spec/util/camunda-moddle.js @@ -1,6 +1,6 @@ 'use strict'; -var any = require('lodash/collection/any'); +var any = require('min-dash').any; var ALLOWED_TYPES = { FailedJobRetryTimeCycle: [ 'bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity' ], diff --git a/test/spec/util/flatten.js b/test/spec/util/flatten.js new file mode 100644 index 00000000..3a811622 --- /dev/null +++ b/test/spec/util/flatten.js @@ -0,0 +1,3 @@ +module.exports = function(array) { + return [].concat.apply([], array); +}; \ No newline at end of file diff --git a/test/util/MockEvents.js b/test/util/MockEvents.js index 062184f2..5ada6233 100644 --- a/test/util/MockEvents.js +++ b/test/util/MockEvents.js @@ -1,6 +1,6 @@ 'use strict'; -var assign = require('lodash/object/assign'); +var assign = require('min-dash').assign; var EventBus = require('diagram-js/lib/core/EventBus'); diff --git a/test/util/merge.js b/test/util/merge.js new file mode 100644 index 00000000..a22e4864 --- /dev/null +++ b/test/util/merge.js @@ -0,0 +1,20 @@ +var isObject = require('min-dash').isObject; +var forEach = require('min-dash').forEach; + +module.exports = function merge(target) { + var sources = [].slice.call(arguments, 1); + if (!sources.length) return target; + var source = sources.shift(); + + if (isObject(target) && isObject(source)) { + forEach(source, function(val, key) { + if (isObject(val) && isObject(target[key])) { + merge(target[key], val); + } else { + target[key] = val; + } + }); + } + + return merge.apply(this, [target].concat(sources)); +}; \ No newline at end of file