Skip to content

Commit

Permalink
remove _.groupBy
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Nov 9, 2023
1 parent 3c4bb59 commit 3176ce0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
{"code": 100, "ignoreComments": true}
],
"max-nested-callbacks": ["warn", 4],
"no-unused-vars": "warn"
"no-unused-vars": "warn",
"no-prototype-builtins": "off"
}
}
14 changes: 9 additions & 5 deletions src/dbsolve-export/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,15 @@ class DBSolveExport extends AbstractExport{
assignments
};
});
// group Const
let groupedConst = _.groupBy(
ns.selectByClassName('Const'),
(constant) => _get(constant, this.groupConstBy)
);
// group Const, instead of _.groupBy
let groupedConst = {}; // {group1: [const1, const2], group2: [const3, const4]}
ns.selectByClassName('Const').forEach((constant) => {
let key = _get(constant, this.groupConstBy) + '';
if (!groupedConst.hasOwnProperty(key)) {
groupedConst[key] = [];
}
groupedConst[key].push(constant);
});

return {
population: ns,
Expand Down
14 changes: 9 additions & 5 deletions src/slv-export/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,15 @@ class SLVExport extends AbstractExport{
logger.error(msg, {type: 'ExportError'});
}

// group Const
let groupedConst = _.groupBy(
ns.selectByClassName('Const'),
(con) => _get(con, this.groupConstBy)
);
// group Const, instead of _.groupBy
let groupedConst = {}; // {group1: [const1, const2], group2: [const3, const4]}
ns.selectByClassName('Const').forEach((constant) => {
let key = _get(constant, this.groupConstBy) + '';
if (!groupedConst.hasOwnProperty(key)) {
groupedConst[key] = [];
}
groupedConst[key].push(constant);
});

return {
population: ns,
Expand Down

0 comments on commit 3176ce0

Please sign in to comment.