Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refactor with thymikee linter ;)
  • Loading branch information
mattphillips committed Aug 14, 2018
commit 9979f0e119c9834ae18452e92fd43001bb6913f2
17 changes: 6 additions & 11 deletions packages/jest-each/src/bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ const applyRestParams = (
supportsDone: boolean,
params: Array<any>,
test: Function,
) => {
if (supportsDone && params.length < test.length)
return done => test(...params, done);

return () => test(...params);
};
) =>
supportsDone && params.length < test.length
? done => test(...params, done)
: () => test(...params);

const getHeadingKeys = (headings: string): Array<string> =>
headings.replace(/\s/g, '').split('|');
Expand Down Expand Up @@ -157,11 +155,8 @@ const interpolate = (title: string, data: any) =>
.reduce(getMatchingKeyPaths(title), []) // aka flatMap
.reduce(replaceKeyPathWithValue(data), title);

const applyObjectParams = (supportsDone: boolean, obj: any, test: Function) => {
if (supportsDone && test.length > 1) return done => test(obj, done);

return () => test(obj);
};
const applyObjectParams = (supportsDone: boolean, obj: any, test: Function) =>
supportsDone && test.length > 1 ? done => test(obj, done) : () => test(obj);

const pluralize = (word: string, count: number) =>
word + (count === 1 ? '' : 's');
Expand Down