Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
fix(allPass/anyPass): Fix wrong args being applied
Browse files Browse the repository at this point in the history
  • Loading branch information
adambrgmn committed Jan 16, 2018
1 parent fb9f597 commit e70a44e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/__tests__/allPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ test('Core.allPass', () => {
expect(allPass([() => true, () => true], 'foo')).toBeTruthy();
expect(allPass([() => true, () => false], 'foo')).toBeFalsy();
expect(allPass([() => false, () => false], 'foo')).toBeFalsy();
expect(allPass([x => x > 0, x => x < 10], 5)).toBeTruthy();
expect(allPass([(x, y) => x === y], 'foo', 'foo')).toBeTruthy();
});
4 changes: 2 additions & 2 deletions src/allPass.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default (predicateList, x) => {
export default (predicateList, ...el) => {
const { length } = predicateList;
let i = 0;
let ret = true;

while (ret) {
ret = predicateList[i](x);
ret = predicateList[i](...el);
i += 1;

if (i >= length) break;
Expand Down
4 changes: 2 additions & 2 deletions src/anyPass.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default (predicateList, x) => {
export default (predicateList, ...el) => {
const { length } = predicateList;
let i = 0;
let ret = false;

while (!ret) {
ret = predicateList[i](x);
ret = predicateList[i](...el);
i += 1;

if (i >= length) break;
Expand Down

0 comments on commit e70a44e

Please sign in to comment.