Skip to content

Commit

Permalink
Avoid reusing variable unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
ReactiveRaven committed Jun 17, 2018
1 parent 98e9187 commit 0dc4e30
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/enzyme/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,8 @@ export function reduceTreeBySelector(selector, root) {
} else if (typeof selector === 'string') {
const tokens = safelyGenerateTokens(selector);
let index = 0;
let token = null;
while (index < tokens.length) {
token = tokens[index];
const token = tokens[index];
/**
* There are two types of tokens in a CSS selector:
*
Expand All @@ -364,8 +363,7 @@ export function reduceTreeBySelector(selector, root) {
// We assume the next token is a selector, so move the index
// forward and build the predicate.
index += 1;
token = tokens[index];
const predicate = buildPredicateFromToken(token);
const predicate = buildPredicateFromToken(tokens[index]);
// We match against only the nodes which have already been matched,
// since a combinator is meant to refine a previous selector.
switch (type) {
Expand Down

0 comments on commit 0dc4e30

Please sign in to comment.