Skip to content

Commit

Permalink
fix makeEvaluators - remove extraneous function in reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
easilyBaffled committed Feb 9, 2019
1 parent a2326d2 commit 48cfe98
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,18 @@ const match = ( matchClauses, testExpression, options = {} ) => {
: result;
};

const _makeEvaluators = (evaluators, target) =>
Object.entries(evaluators)
.reduce((acc, [name,evalFunc] ) => (acc, evalFunc, name) => ({ ...acc, [name]: evalFunc(target) }), {} )
const _makeEvaluators = (evaluators, target) =>
Object.entries(evaluators).reduce(
(acc, [name, evalFunc]) => ({
...acc,
[name]: evalFunc(target)
}),
{}
);

export const makeEvaluators = ( evaluators, target ) => {
if (!target) return _target => _makeEvaluators(evaluators, _target )
return _makeEvaluators(evaluators, target)
}
export const makeEvaluators = (evaluators, target) => {
if (!target) return _target => _makeEvaluators(evaluators, _target);
return _makeEvaluators(evaluators, target);
};

export default match;

0 comments on commit 48cfe98

Please sign in to comment.