X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2Fmodel%2FDescriptorTemplateFactory.js;h=2946f1874a080ea6a3d8ffc77d1b66cde0f96b02;hb=4ef8c40c2c013c21f5487330daeab2561ba25fb3;hp=28e74807b54fa88135822eca4140f7c86b86f3a3;hpb=e29efc315df33d546237e270470916e26df391d6;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/libraries/model/DescriptorTemplateFactory.js b/skyquake/plugins/composer/src/src/libraries/model/DescriptorTemplateFactory.js index 28e74807b..2946f1874 100644 --- a/skyquake/plugins/composer/src/src/libraries/model/DescriptorTemplateFactory.js +++ b/skyquake/plugins/composer/src/src/libraries/model/DescriptorTemplateFactory.js @@ -23,7 +23,10 @@ 'use strict'; -import _ from 'lodash' +import _isFunction from 'lodash/isFunction' +import _isArray from 'lodash/isArray' +import _isObject from 'lodash/isObject' +import _cloneDeep from 'lodash/cloneDeep' import DescriptorTemplates from './DescriptorTemplates' import DescriptorModelMetaFactory from './DescriptorModelMetaFactory' @@ -33,13 +36,13 @@ function resolveInitHandlers(model) { function init(m) { keys(m).map(key => { const value = m[key]; - if (_.isFunction(value)) { + if (_isFunction(value)) { m[key] = value(m, key, model); } - if (_.isArray(value)) { + if (_isArray(value)) { value.forEach(v => init(v)); } - if (_.isObject(value)) { + if (_isObject(value)) { init(value); } }); @@ -52,7 +55,7 @@ export default { createModelForType(type) { const template = DescriptorTemplates[type]; if (template) { - const model = _.cloneDeep(template); + const model = _cloneDeep(template); return resolveInitHandlers(model); } }