Skip to content

Commit

Permalink
Remove ternary expression in indexable assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrottimark committed Mar 2, 2019
1 parent 08b54d2 commit ed4f245
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/expect/src/matchers.ts
Expand Up @@ -424,7 +424,7 @@ const matchers: MatchersObject = {
return {message, pass};
}

const indexable = Array.isArray(received) ? received : Array.from(received);
const indexable = Array.from(received);
const index = indexable.indexOf(expected);
const pass = index !== -1;

Expand Down Expand Up @@ -478,8 +478,7 @@ const matchers: MatchersObject = {
);
}

const indexable = Array.isArray(received) ? received : Array.from(received);
const index = indexable.findIndex(item =>
const index = Array.from(received).findIndex(item =>
equals(item, expected, [iterableEquality]),
);
const pass = index !== -1;
Expand Down

0 comments on commit ed4f245

Please sign in to comment.