Skip to content

Commit

Permalink
remove _.defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Nov 8, 2023
1 parent a55bc14 commit 680d9e4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
20 changes: 10 additions & 10 deletions src/container/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ Container.prototype.insert = function(q = {}, isCore = false){
let exportCheck = q.class.match(/^(\w+)Export$/);
if (exportCheck !== null) { // check if old export syntax is used
this.logger.warn(`Usage of Export is deprecated starting from v0.5.0, use syntax: #export {format: ${exportCheck[1]}, ...}`)
let exportQ = _.omit(q, ['class', 'id']);
_.defaults(exportQ, {
let _exportQ = _.omit(q, ['class', 'id']);
let exportQ = Object.assign({
format: exportCheck[1],
filepath: q.id
});
}, _exportQ);
return this.export(exportQ);
}

Expand Down Expand Up @@ -356,12 +356,12 @@ Container.prototype.setNS = function(q = {}){
*
* @returns {Component[]} Array of cloned components.
*/
Container.prototype.importNS = function(q = {}){
_.defaults(q, {
Container.prototype.importNS = function(_q = {}){
let q = Object.assign({
prefix: '',
suffix: '',
rename: {}
});
}, _q);

let space = q.space || 'nameless';
if (q.fromId) {
Expand Down Expand Up @@ -459,14 +459,14 @@ Container.prototype.moveNS = function(q = {}){
*
* @returns {Component} Cloned component.
*/
Container.prototype.import = function(q = {}){
let ind = getIndexFromQ(q);
Container.prototype.import = function(_q = {}){
let ind = getIndexFromQ(_q);

_.defaults(q, {
let q = Object.assign({
prefix: '',
suffix: '',
rename: {}
});
}, _q);

let space = q.space || 'nameless';
// checking arguments
Expand Down
12 changes: 6 additions & 6 deletions src/core/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ class Component {
return componentClone;
}
/** Change referencies of component based on suffix/prefix/rename */
updateReferences(q = {}){
updateReferences(_q = {}){
// set defaults
_.defaults(q, {
let q = Object.assign({
prefix: '',
suffix: '',
rename: {}
});
}, _q);

// change references
const iterator = (item, path) => { // Actor { target: 'y', stoichiometry: -1 }, actors[0].target
Expand Down Expand Up @@ -222,13 +222,13 @@ class Component {

return res;
}
toFlat(options = {}){
toFlat(_options = {}){
// set defaults
_.defaults(options, {
let options = Object.assign({
simplifyModifiers: true,
simplifyActors: true,
simplifyExpressions: true
});
}, _options);

let q = this.toQ(options);
let res = flatten(q);
Expand Down
7 changes: 3 additions & 4 deletions src/core/top.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Top class for all other items of platform
*/

const _ = require('lodash');
const randomId = require('random-id');
const { ajv } = require('../utils');
const { flatten } = require('./utilities');
Expand Down Expand Up @@ -91,13 +90,13 @@ class Top { // or const Top = class {...}

return q;
}
toFlat(options = {}){
toFlat(_options = {}){
// set defaults
_.defaults(options, {
let options = Object.assign({
simplifyModifiers: true,
simplifyActors: true,
simplifyExpressions: true
});
}, _options);

let q = this.toQ(options);
let res = flatten(q);
Expand Down

0 comments on commit 680d9e4

Please sign in to comment.