Skip to content
Permalink
Browse files

Chore: removes unnecessary assignment in loop (#11780)

* Chore: removes unnecessary assignment in loop

also reduces cyclomatic complexity with a slight reconfiguring of some conditions

* uses ternary based on review notes
  • Loading branch information...
dimitropoulos authored and ilyavolodin committed Jun 8, 2019
1 parent 20908a3 commit e0fafc8ef59a80a6137f4170bbe46582d6fbcafc
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/linter/node-event-generator.js
@@ -221,17 +221,19 @@ class NodeEventGenerator {
const selector = parseSelector(rawSelector);

if (selector.listenerTypes) {
selector.listenerTypes.forEach(nodeType => {
const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType;
const typeMap = selector.isExit ? this.exitSelectorsByNodeType : this.enterSelectorsByNodeType;

selector.listenerTypes.forEach(nodeType => {
if (!typeMap.has(nodeType)) {
typeMap.set(nodeType, []);
}
typeMap.get(nodeType).push(selector);
});
} else {
(selector.isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors).push(selector);
return;
}
const selectors = selector.isExit ? this.anyTypeExitSelectors : this.anyTypeEnterSelectors;

selectors.push(selector);
});

this.anyTypeEnterSelectors.sort(compareSpecificity);

0 comments on commit e0fafc8

Please sign in to comment.
You can’t perform that action at this time.